【问题标题】:Moving WCF service from IIS 6.0 to IIS 7.5将 WCF 服务从 IIS 6.0 移动到 IIS 7.5
【发布时间】:2012-03-14 08:19:41
【问题描述】:

我正在 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 设置中寻找什么来解决这个问题。

【问题讨论】:

  • AppPool 是否运行正确版本的 ASP.NET?
  • @Richard Blewett - 服务配置为使用 .NET 3.5 框架。我遵循在 IIS 6.0 中使用的相同配置,因为您只能为 asp.net IIS 设置选择 .NET 1.1、2.0 或 4.0 框架
  • 运行应用程序池的身份是否有权访问服务文件的物理位置?
  • @RichardBlewett- 应用程序池标识具有遍历文件夹/执行文件、列出文件夹/读取数据、读取属性、读取扩展属性和使用有效权限查找的读取权限。

标签: wcf iis-6 iis-7.5 windows-server-2008-r2


【解决方案1】:

我必须从我的 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>

【讨论】:

    【解决方案2】:

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

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

    【讨论】:

      猜你喜欢
      • 2012-06-16
      • 1970-01-01
      • 2013-01-21
      • 2023-04-07
      • 2011-12-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-01
      相关资源
      最近更新 更多