简体   繁体   English

Microsoft.Web.Administration(用于IIS7自动化)在VS 2010中不起作用

[英]Microsoft.Web.Administration (for IIS7 automation) doesn't work in VS 2010

I'm trying to experiment with Microsoft.Web.Administration on my Windows 7 x64 box, using Visual Studio 2010. When I add the DLL to references in my C# project, I can see its namespaces and classes pop up in Intellisense. 我正在尝试使用Visual Studio 2010在我的Windows 7 x64盒子上试验Microsoft.Web.Administration。当我将DLL添加到我的C#项目中的引用时,我可以看到它的名称空间和类在Intellisense中弹出。

But as soon as I build, I get "The type or namespace name 'Web' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)", and I get build errors in the code I've written, as if the DLLs aren't even there. 但是一旦我构建,我得到“类型或命名空间名称'Web'在命名空间'Microsoft'中不存在(你是否缺少程序集引用?)”,我在编写的代码中遇到构建错误,就好像DLL甚至不存在一样。

There are two sets of IIS7 DLLs that I can see, in: 我可以看到有两组IIS7 DLL:

  • %windir%\\system32\\inetsrv %WINDIR%\\ SYSTEM32 \\ INETSRV
  • %windir%\\syswow64\\inetsrv %WINDIR%\\ Syswow64资料\\ INETSRV

But both sets seem to do the same thing: Apparently initially work, then fail on build. 但两套似乎都做了同样的事情:显然最初工作,然后失败的构建。

Does anyone know what I need to do to get this working? 有谁知道我需要做些什么来使这个工作?

If this is a .NET 3.5 or .NET 4.0 project, open the project properties. 如果这是.NET 3.5或.NET 4.0项目,请打开项目属性。 On the Application tab it will have probably defaulted to either of: 在“应用程序”选项卡上,它可能默认为以下任一项:

  • .NET Framework 3.5 Client Profile .NET Framework 3.5客户端配置文件
  • .NET Framework 4 Client Profile .NET Framework 4客户端配置文件

Change this to .NET Framework 3.5 or .NET Framework 4. Your project should then build just fine. 将其更改为.NET Framework 3.5或.NET Framework 4.然后,您的项目应该正常构建。

As the compiler error points out, Microsoft.Web.Administration has a dependency on System.Web which isn't referenced in the 3.5/4.0 client profiles. 正如编译器错误所指出的那样, Microsoft.Web.AdministrationSystem.Web有依赖性,而在3.5 / 4.0客户端配置文件中没有引用它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Microsoft.Web.Administration命名空间在IIS7中干净地操作Handler Mappings? - How do I manipulate Handler Mappings cleanly in IIS7 using the Microsoft.Web.Administration namespace? 使用模拟自动创建IIS7网站(使用Microsoft.Web.Administration) - Automating IIS7 Website creation using impersonation (with Microsoft.Web.Administration) 在VS2010中运行测试项目的Microsoft.Web.Administration的ReflectionTypeLoadException - ReflectionTypeLoadException for Microsoft.Web.Administration running Test Project in VS2010 在VS 2010中包含Microsoft.Web.Administration程序集引用的正确方法 - Proper way to include the Microsoft.Web.Administration assembly reference in VS 2010 使用Microsoft.Web.Administration以编程方式在IIS7中创建远程站点:索引无效。 (来自HRESULT的异常:0x80070585) - Programmatically creating a remote site in IIS7 using Microsoft.Web.Administration: Invalid index. (Exception from HRESULT: 0x80070585) IIS:如何使用Microsoft.Web.Administration在网站中创建虚拟目录 - IIS: How to create virtualdirectory in website with Microsoft.Web.Administration IIS 8的Microsoft.Web.Administration不会显示所有站点 - Microsoft.Web.Administration for IIS 8 does not display all sites IIS-如何使用Microsoft.Web.Administration编辑应用程序的本地配置 - IIS - How to edit local config for application with Microsoft.Web.Administration Microsoft.Web.Administration Ssl 证书未在 iis 管理器中选择 - Microsoft.Web.Administration Ssl cert not selected in iis manager .Net Core和Microsoft.Web.Administration - .Net Core and Microsoft.Web.Administration
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM