Parser Error in Web Application after deploying

2019-09-05 14:28发布

I get parse error after uploading my Web Application to my server. I had an ASP.NET Web Site, but I migrated my files into a Web Application Project. Now, after I completed moving the files to the new project, everything works all right locally, but not at the remote server.

now afther i upload it to the server i get this error: IIS Server Error - Parser Error: Could not load type Main

EDIT-------- this problem just keeping coming back even afther i tried put namespaces on of the .cs files and republish the site. even afther i publish the site all the CodeBhind files desapper so i add them myself via copy-past.

here how the solution explorer look and 1 of my aspx. files mybee you will see somthing worng i did:

enter image description here

enter image description here here is my config file code:

<?xml version="1.0"?>
 <configuration>
   <system.web>
    <compilation debug="true" targetFramework="4.0">
   </compilation>
  </system.web>
 </configuration>

EDIT----------------------------------------- i can see the site now online, what i needed to do is give all the files the same namespace, and not use a out side folder (witch i used every time) i just drop all the files/folders in the webroot thank you all!.

3条回答
做个烂人
2楼-- · 2019-09-05 14:51

I suspect you did not deploy the code-behind: main.aspx.cs

查看更多
太酷不给撩
3楼-- · 2019-09-05 15:00

You probably have to set up namespaces for your entire project. Look at this walkthrough from Scott Gu's blog. It's for Visual Studio 2005, but it's pretty much the same.

查看更多
Emotional °昔
4楼-- · 2019-09-05 15:10
<?xml version="1.0"?>
 <configuration>
   <system.web>
    <compilation debug="true" targetFramework="4.0">
   </compilation>
  </system.web>
 </configuration>

As per your web.config your target framework is 4.0 . Have you checked same your web site running in application pool in IIS is working on the same framework version?

If the framework is different on IIS than it might be cause of it. You can check it by Select the site on IIS, click ASP.NET tab, select ASP.NET version dropdown box.

查看更多
登录 后发表回答