开发者

ASP.NET Compilation Error

I'm working on a Web Site project (not Web Application) under Visual Web Developer Express Edition 2008 and using C# as the language.

In the web site I'm having a reference to a Service (an ASMX file in a server). When I run the application locally it can show the Default.aspx with no problems but when I upload it to my hosting site it gives me a "Compilation Error":

Compilation Error    
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: CS0234: The type or namespace name 'ServiceModel' does not exist in the namespace 'System' (are you missing an assembly reference?)    
Source Error:    
[No relevant source lines]    
Source开发者_开发技巧 File: App_WebReferences.doheyfto.0.cs    Line: 791

I don't why it's giving this error, I used this same Service reference in a Web Application project and it works fine.

I tried manually adding the reference to System.ServiceModel.Web to my project and also copying the corresponding DLL file to the BIN folder but then I get an error on a different namespace, I think this is not the solution, I guess that the namespaces that are referenced (from the .NET Framework) should be added automatically to the project, shouldn't it work like that?

Thank you all in advance


System.ServiceModel only exists in .NET 3.0 or higher. You should make sure your hosting provider supports at least that version of the framework.


Make sure that System.ServiceModel assembly is also included in web.config under compilation tag - something like

<compilation defaultLanguage="c#" debug="true">
   <assemblies>
     ...
     <add assembly="System.ServiceModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
   </assemblies>
</compilation>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜