简体   繁体   English

Web服务配置问题

[英]Web Service Configuration Problem

I host 2 WCF web services and 1 standard .NET web service from an application directory.我托管 2 个 WCF web 服务和 1 个标准 .NET Z2567A5EC9705EB7AC2C984033E0618 应用程序目录。 The .NET service and 1 of the WCF services works perfectly; .NET 服务和 WCF 服务之一完美运行; however, the other WCF service is returning the following error:但是,其他 WCF 服务返回以下错误:

The service cannot be activated because it does not support ASP.NET compatibility.该服务无法激活,因为它不支持 ASP.NET 兼容性。 ASP.NET compatibility is enabled for this application.为此应用启用了 ASP.NET 兼容性。 Turn off ASP.NET compatibility mode in the web.config or add the AspNetCompatibilityRequirements attribute to the service type with RequirementsMode setting as 'Allowed' or 'Required'.在 web.config 中关闭 ASP.NET 兼容模式,或将 AspNetCompatibilityRequirements 属性添加到服务类型,RequirementsMode 设置为“Allowed”或“Required”。

Both WCF web services have the line WCF web 服务都有线路

<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)> _

and the web.config file has web.config 文件有

<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />

To add more confusion to the mix, when I change为了增加更多的混乱,当我改变

AspNetCompatibilityRequirementsMode.Allowed

to

AspNetCompatibilityRequirementsMode.Required

the service works just fine.服务很好。

Also, changing还有,变

<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />

to

<serviceHostingEnvironment aspNetCompatibilityEnabled="false" />

in the web.config also allows all web services to function.在 web.config 中还允许所有 web 服务到 function。

This problem is presenting on both IIS7 and our staging enviorment hosted on SBS2003 running IIS6.这个问题出现在 IIS7 和我们在运行 IIS6 的 SBS2003 上托管的暂存环境中。

Thank you in advance for all of your help.预先感谢您的所有帮助。
Jake杰克

UPDATE:更新:
I was able to get it to work by deleting the application on my development system;我可以通过删除我的开发系统上的应用程序来让它工作; however, the problem still persists on our staging server, even after deleting the application and recreating it there.但是,即使在删除应用程序并在那里重新创建后,问题仍然存在于我们的暂存服务器上。

WORK AROUND:解决方法:

  1. Delete the Application from IIS从 IIS 中删除应用程序
  2. Recreate the direcotry重新创建目录
  3. Create a New Application Pool创建一个新的应用程序池
  4. In the properties of the direcotry, create the Application and associate it to the new Application Pool.在目录的属性中,创建应用程序并将其关联到新的应用程序池。

What a pain.多么痛苦。

You can not host 2 different framework version of service under single application pool.您不能在单个应用程序池下托管 2 个不同框架版本的服务。 What i mean is that if you have hosted 2 WebService ( One is using Framework 2.0 and another is using framework 4.0) under single application pool, any one service will work.我的意思是,如果您在单个应用程序池下托管了 2 个 WebService(一个使用 Framework 2.0,另一个使用 Framework 4.0),那么任何一项服务都可以工作。 Second will never work第二个永远行不通

SOLUTION:解决方案:

    Create 2 different application Pool. 创建 2 个不同的应用程序池。 App1 (Target Framework 2.0) and App2 (Target Framework 4.0) App1(目标框架 2.0)和 App2(目标框架 4.0)
    Assign App1 pool to that service which developed in Framework 2.0. 将 App1 池分配给在 Framework 2.0 中开发的服务。
    Assign App2 pool to that service which developed in Framework 4.0. 将 App2 池分配给在 Framework 4.0 中开发的服务。
    Restart IIS 重启IIS

It should work now.它现在应该可以工作了。

WORK AROUND:解决方法:

  • Delete the Application from IIS从 IIS 中删除应用程序
  • Recreate the direcotry重新创建目录
  • Create a New Application Pool创建一个新的应用程序池
  • In the properties of the direcotry, create the Application and associate it to the new Application Pool.在目录的属性中,创建应用程序并将其关联到新的应用程序池。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM