将 WCF 服务从 IIS 6.0 迁移到 IIS 7.5

发布于 2025-01-08 14:12:40 字数 2598 浏览 1 评论 0原文

我正在 Windows Server 2008 R2 计算机上将 WCF 服务从 IIS 6.0 迁移到 IIS 7.5。当我使用任何主要浏览器浏览服务时,出现以下错误:

500 - 内部服务器错误。
存在问题 您正在查找的资源,无法显示。

我检查了服务器的事件日志,没有发现任何异常情况。该服务的身份验证设置设置为匿名。我尝试将服务的应用程序池托管管道模式设置为集成和经典,但仍然得到相同的结果。应用程序池的.NET框架是v2.0.50727。

以下是服务的 web.config 文件中的 system.serviceModel 部分:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="windowsBasicHttpBinding">
            <security mode="None">
            <transport clientCredentialType="None" />
        </security>
        </binding>
        <binding name="basicHttpBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
             receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
         bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
         maxBufferSize="65536" maxBufferPoolSize="524288"
             maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8"    
             transferMode="Buffered" useDefaultWebProxy="true">
            <readerQuotas maxDepth="32" maxStringContentLength="8192"
                 maxArrayLength="16384" maxBytesPerRead="4096"maxNameTableCharCount="16384"            
                />
            <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
        </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <services>
        <service behaviorConfiguration="MyService.WCFService.RoutingServiceBehavior" name="MyService.WCFService.RoutingService">
        <endpoint binding="basicHttpBinding"
             bindingConfiguration="windowsBasicHttpBinding" name="basicEndPoint"        
             contract="MyService.WCFService.IRoutingService" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    </service>
    </services>
    <behaviors>
        <serviceBehaviors>
        <behavior name="CityOfMesa.ApprovalRouting.WCFService.RoutingServiceBehavior">
            <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
    </serviceBehaviors>
    </behaviors>
</system.serviceModel>

我应该在 IIS 配置或 web.config 设置中查找什么来解决此问题。

I am in the process of moving a WCF service from IIS 6.0 to IIS 7.5 on a Windows Server 2008 R2 machine. When I browse to service using any of the major browsers, I get the following error:

500 - Internal server error.
There is a problem with the
resource you are looking for, and it cannot be displayed.

I checked the server's event logs and do not see anything that looks out of the ordinary. The service's authentication settings is set to Anonymous. I tried setting the service's application pool Managed pipeline mode to both Integrated and Classic and I still get the same result. The .NET framework of the application pool is v2.0.50727.

Here is the system.serviceModel section in the service's web.config file:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="windowsBasicHttpBinding">
            <security mode="None">
            <transport clientCredentialType="None" />
        </security>
        </binding>
        <binding name="basicHttpBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
             receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
         bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
         maxBufferSize="65536" maxBufferPoolSize="524288"
             maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8"    
             transferMode="Buffered" useDefaultWebProxy="true">
            <readerQuotas maxDepth="32" maxStringContentLength="8192"
                 maxArrayLength="16384" maxBytesPerRead="4096"maxNameTableCharCount="16384"            
                />
            <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
        </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <services>
        <service behaviorConfiguration="MyService.WCFService.RoutingServiceBehavior" name="MyService.WCFService.RoutingService">
        <endpoint binding="basicHttpBinding"
             bindingConfiguration="windowsBasicHttpBinding" name="basicEndPoint"        
             contract="MyService.WCFService.IRoutingService" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    </service>
    </services>
    <behaviors>
        <serviceBehaviors>
        <behavior name="CityOfMesa.ApprovalRouting.WCFService.RoutingServiceBehavior">
            <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
    </serviceBehaviors>
    </behaviors>
</system.serviceModel>

What should I look for in my IIS configuration or web.config settings to fix this issue.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

请帮我爱他 2025-01-15 14:12:41

我必须从 web.config 中删除以下部分才能使服务在 Windows Servers 2008 R2 上的 IIS 7.5 下运行:

<modules>
        <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </modules>
    <handlers>
        <remove name="WebServiceHandlerFactory-Integrated"/>
        <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
             type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
             type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </handlers>

I have to remove the following section from my web.config to get the service run under IIS 7.5 on Windows Servers 2008 R2:

<modules>
        <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </modules>
    <handlers>
        <remove name="WebServiceHandlerFactory-Integrated"/>
        <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
             type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
             type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </handlers>
你好,陌生人 2025-01-15 14:12:41

使用提升的权限(以管理员身份)执行以下命令:

"%WINDIR%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -i

Execute the following command with elevated privileges (as administrator):

"%WINDIR%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -i
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文