0

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!.

5
  • Just to understand - did you go from website to web application project? Also, did you upload the contents of the bin folder? The two use different compilation models, but you need the dlls from the bin folder locally to be in the bin folder on the server. Commented Feb 29, 2012 at 18:45
  • yeah i did, every thing work loclay. i used msdn.microsoft.com/en-us/library/aa983476.aspx guide for it. Commented Feb 29, 2012 at 18:54
  • 1
    This is often a pain! Make sure you delete all of the remote files first, then redeploy from the published files. Commented Feb 29, 2012 at 18:56
  • Post your current main.aspx page AND the code behind for it. Commented Mar 1, 2012 at 0:20
  • i added the code behind of the main.aspx page but i should add that im using iframe in the main.aspx page so i can see the page i just added him the server side code and he is in a diffrent folder. Commented Mar 1, 2012 at 10:03

3 Answers 3

2

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.

Sign up to request clarification or add additional context in comments.

4 Comments

i read the walkthrough thx :). got a qustion: should i add to all the CodeBhind class namespace? or only class that are in Old_App_Code (no one got any namesapce) if i need to add namespace, should i use the same namespace for all of them?
i post an edit please look mybee you will see somthing worng.
@samy yes. Use the same namespace for all your project files. E.g. MyWebApplication1. You should use the same namespace that you have specified in the project settings. What errors are you currently receiving?
aspspider.info/thesamy/PublishedGallerieTESTAPP22/MainPage/… this my site link it will show you the error this include the class with the namespace (its the same parser error)
2
<?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.

4 Comments

im not sure that this is the problem, im using this host:aspspider.com for my site is a free host for small sites (i use it for QA) and he uses framework 4.0.
@Samy.. Please verify once with your host. I have faced this problem before and this was resolved my issue. This might be help you to resolve this problem.
so to ask if its possible to upload a site that uses the 4.0 framework?
yes. I mean does they support 4.0 framework or what is the procedure to upload website which uses 4.0 framework.
-1

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

3 Comments

but i did publish site befor i upload it to the server it dosnt add the files automticly?
i added the files .cs and .designer.c fiels but still get the same error what more can it be? – samy just now edit
You shouldn't deploy the code behind files for Web Application Projects. That's one of the reasons to use WAP's in the first place.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.