2011-07-13 174 views
2

我的Windows Server 2008 R2上有IIS7。我部署了WCF服务。当我在浏览器(本地或外部机器)中指定WCF服务地址时http://sbkisourcedev01/VCIndex/Calculator.svc?wsdl我正在浏览器中获取服务描述。然而,当我试图给项目添加到该服务我收到以下错误参考:WCF IIS服务器配置

 
The document was understood, but it could not be processed. 

    - The WSDL document contains links that could not be resolved. 
    - There was an error downloading 'http://sbkisourcedev01/VCIndex/Calculator.svc?xsd=xsd0'. 
    - The underlying connection was closed: An unexpected error occurred on a receive. 
    - Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. 
    - An existing connection was forcibly closed by the remote host 

Metadata contains a reference that cannot be resolved: 'http://sbkisourcedev01/VCIndex/Calculator.svc?wsdl'. 
Content Type application/soap+xml; charset=utf-8 was not supported by service http://sbkisourcedev01/VCIndex/Calculator.svc?wsdl. The client and service bindings may be mismatched. 
The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'.. 
If the service is defined in the current solution, try building the solution and adding the service reference again. 

我有这样的服务在Windows 7上运行,它是好的。所以我相信我的W2K8 IIS配置设置有一些东西。

这里是我的配置文件:

<system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="basicHttpBindingConfig" /> 
     </basicHttpBinding> 
    </bindings> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="serviceBehavior"> 
      <serviceMetadata httpGetEnabled="true"/> 
      <serviceDebug includeExceptionDetailInFaults="true"/> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 
    <services> 
     <service behaviorConfiguration="serviceBehavior" 
       name="WCFVCIndex.Calculator"> 
     <endpoint address="" 
        binding="basicHttpBinding" 
        contract="WCFVCIndex.ICalculator" 
        bindingConfiguration="basicHttpBindingConfig" /> 
     <endpoint address="mex" 
        binding="mexHttpBinding" 
        contract="IMetadataExchange" /> 
     </service> 
    </services> 
    </system.serviceModel> 

在此先感谢。

回答

7

问题在于WCF身份权限。用于承载WCF服务的应用程序池的标识必须在%WINDIR%\ temp文件夹上具有完整的NTFS权限。在C:\ Windows \ Temp上将该权限更改为我的身份(本地服务)后,我可以将服务引用添加到WCF服务。

+0

谢谢,你刚刚救了我的一天! +1 –

+0

你是怎么做到的?你能提一下这些步骤吗? – SamekaTV

1
+0

感谢您的帮助。它不起作用。我得到这个错误:下载'http:// sbkisourcedev01/VCIndex/mex'时出错。 请求失败,HTTP状态404:未找到。 元数据包含无法解析的引用:'http:// sbkisourcedev01/VCIndex/mex'。 –