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

时间:2012-02-23 21:08:28

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

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

  

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

我检查了服务器的事件日志,看不到任何看似异常的东西。服务的身份验证设置设置为匿名。我尝试将服务的应用程序池托管管道模式设置为Integrated和Classic,但我仍然得到相同的结果。应用程序池的.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设置中查找什么来解决此问题。

2 个答案:

答案 0 :(得分:1)

我必须从我的web.config中删除以下部分才能在Windows Server 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>

答案 1 :(得分:0)

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

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