3

I have a asp.net project that is working very well on my machine (on localhost) ... But when I put it on a real host (put it online) a faced a problem .... I got this error :

Parser Error

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

Parser Error Message: Could not load type 'AWP_Project.Default'.

Source Error:

Line 1: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AWP_Project.Default" %> Line 2:
Line 3:

there is a problem in the first line of this page (and every other page when I try it) note : my project name is AWP_Project can anybody helps my please ???

Mahmoud Al-Qudsi
  • 28,357
  • 12
  • 85
  • 125
Shadi
  • 1,526
  • 3
  • 11
  • 14
  • how do you exactly put it online ? Do you use publish ? – Antonio Bakula May 07 '12 at 22:08
  • 2
    did you upload a "bin" folder? – russau May 07 '12 at 22:11
  • @AntonioBakula : no I don't used publish .... I used a ftp program called coreFtp – Shadi May 07 '12 at 22:18
  • @russau : yes I uploaded the "bin" folder ... shouldn't I ? – Shadi May 07 '12 at 22:19
  • maybe you do not have fix the web.config properly for run online. – Aristos May 07 '12 at 22:21
  • use publish, right click on project and select "Build Deployment Package" and copy that with coreFTP, btw. that is for Web Application maybe is same for "Web Site" project but never used one so I am not sure – Antonio Bakula May 07 '12 at 22:24
  • 1
    You might want to check this thread, the question is similar and there are a lot of suggestions on how to fix it. http://stackoverflow.com/questions/1598829/parser-error-message-could-not-load-type-testmvcapplication-mvcapplication – SCB May 07 '12 at 22:55

2 Answers2

1

A common "pitfall" when it comes to moving your (compiled or not) project to your web host from your local machine is that the web host may not have the same configuration as your project/local/development machine.

  • make sure you have all the assemblies in your /bin folder
  • if you somehow created assemblies (dlls) for each file, then make sure all of them are copied to your web host
  • Your web host will (likely) have different security settings than your own machine while you are debugging. You're working on full trust locally/in Visual Studio, while most, if not all web hosts will likely be using medium trust. So a good rule of thumb while developing in Visual Studio is to set your web.config to medium trust to avoid pitfalls "at the last moment" - particularly if you don't have a dedicated machine at your web host.
  • just because you have .Net 4 on your machine, doesn't automatically mean your web host has it. You can bin deploy the assemblies you need - in VS 2010 right click your project and select "Add Deployable Dependencies" - this will add all the necessary dlls you need in your /bin folder. Yes, you will likely not need all of them, but unless/until you're fairly comfortable in choosing which one should or shouldn't be deployed, you'll have to trust Visual Studio....
  • I'm hesitant to add this, but still - ask your web host what verison of ASP.Net/.Net Framework they support. It sounds funny but trust me, I'm hosted on one of the largest and well known/trusted web hosts out there and to this day, I have to contact support (but their support is "fanatical" - clue to who it is) to have my web site/s set to ASP.Net 4 (they support it but an extra manual config is needed by their personnel).

hth

EdSF
  • 11,753
  • 6
  • 42
  • 83
1

Try to create a virtual directory/website on your remote host and upload to root of that virtual directory via copy web site menu or publish website.

Often, your app doesn't work if you upload to a folder only. you should copy to the root of virtual directory or create a virtual dir that refer to your folder.

Please check this url link: Cannot use asp classes in app code/bin/web service

Hope this help