2011-07-13 172 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'。 –