开发者

System.Web.Hosting not found in VS2008

开发者 https://www.devze.com 2023-01-29 01:40 出处:网络
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, an

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 serio开发者_开发技巧usly appreciated.

Thanks.


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.


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

0

精彩评论

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