Open Closed

layout.cshtml compilation error #49

charles.wright created

After upgrading number of applications to version, one of my applications now results in the following error after being deployed to our IIS web server (8). The error does not occur running locally with IISExpress:

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0103: The name 'ApplicationPath' does not exist in the current context

Source Error:

Line 20: 	<script type="text/javascript">
Line 21: 		//This is used to get the application's root path from javascript. It's useful if you're running application in a virtual directory under IIS.
Line 22: 		var abp = abp || {}; abp.appPath = '@ApplicationPath';
Line 23: 	</script>
Line 24:

Source File: c:\inetpub\wwwroot\WebFred\App\Main\views\layout\layout.cshtml Line: 22

I checked the versions of all DLLs on the server and they are correct.

Another project upgraded at the same time works correctly. Is there anything I can look at that might help resolve this issue?



1 Answer(s)
  • 0
    hikalkan created
    Support Team


    Your view should be inherited from AbpWebViewPage. This is done by web.config file. In template: <a class="postlink" href=""> ... web.config</a>

    You see <pages pageBaseType="MySpaProject.WebSpaAngular.Views.MySpaProjectWebViewPageBase">

    And MySpaProjectWebViewPageBase is inherited from AbpWebViewPage.

    If you can't fix it share location of the cshtml file that cause exception.

    Lastly, you can remove the like and it will be work unless you publish your web site into a virtual directory under iis.