I\'ve finished simple asp.net web application project, compiled it, and try to test on local IIS. I\'ve create virtual directory, map it with physical directory, then put al
IIS 7 or IIS 8 or 8.5 version - if you are migrating from 2003 to 2012/2008 make sure web service are in application type instead virtual directory
I am too late but let me explain how I solved this problem.
This problem is basically because of improper folders/solution structure.
this issue may occur because 1. If you have copied project from other location and trying to run the project.
so to resolve this go to original location and crosscheck the folders and files again.
this works for me.
Try changing CodeBehind="Default.aspx.cs"
to CodeFile="Default.aspx.cs"
Interesting all the different scenarios..
In my case...I had uploaded my site to GoDaddy and was getting the Parser Error.
I resolved it by commenting out compilers
under system.codedom
in web.config.
And also add a custom profile for publishing that would precompile during publishing.
<system.codedom>
<!--GoDaddy does not compile!-->
<!--<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
</compilers>-->
</system.codedom>
Very old question here, but I ran into the same error and none of the provided answers solved the issue.
My issue occurred because I manually changed the namespace and assembly names of the project after initial creation. Took me a little bit to notice that the namespace in the Inherits
attribute didn't match the updated namespace.
Updating that namespace in the Global.asax markup to match the apps namespace fixed the error for me.
I had the same issue. Ran 5 or 6 hours of researches. A simple solution seems to be working. I just had to convert my folder to application from iis. It worked fine. (this was a scenario where I had done a migration from server 2003 to server 2008 R2)
(1) Open IIS and select the website and the appropriate folder that needs to be converted. Right-click and select Convert to Application.