System.Web.Hosting not found in VS2008

穿精又带淫゛_ 提交于 2019-12-11 03:39:01

问题


I am trying to make a Cassini-like server for a particular asp.net web application. The Client is not happy with the Cassini interface, so I am just expanding the Cassini code, adding new features, and providing a fresh look to the UI.

Now the problem I am facing is, all the files from Cassini source use the System.Web.Hosting namespace. Visual Studio throws me an error saying:

The type or namespace name 'Hosting' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

What am I missing here? I have already written

using System.Web.Hosting;

in the first line of the .cs file. I am using .Net FW 3.5 and VS2008.

Any help would be seriously appreciated.

Thanks.


回答1:


Most likely, your project is targeting the "Client Profile" version of the .NET Framework, which doesn't include the System.Web.Hosting namespace.

You need to change your project to target the full version of the framework, and then add a reference to System.Web. To do this, follow these steps:

  1. Open your project Properties by double-clicking on "Properties" in the Solution Explorer.

  2. From the drop-down box labeled "Target framework," choose ".NET Framework 3.5". Visual Studio will inform you that this requires closing and re-opening your project, so make sure that it is saved first before clicking "Yes".

  3. When your project re-opens, right click on "References" in the Solution Explorer, and select "Add Reference" from the context menu.

  4. Find the item named "System.Web" under the ".NET" tab in the resulting dialog box, and click OK.




回答2:


You have to add the System.Web reference to the project.



来源:https://stackoverflow.com/questions/4376626/system-web-hosting-not-found-in-vs2008

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!