2012-06-14 180 views
0

嗨我已經在服務器計算機上部署了WCF Web服務。我可以在瀏覽器中瀏覽它。但是當我去到它的服務引用到開發計算機上我的web應用程序我得到以下細節錯誤:無法訪問託管在服務器上的遠程WCF Web服務

Metadata contains a reference that cannot be resolved: 'http://ServerMachineName:500/ITCAMSWebService_deploy/Services/Authentication.svc?wsdl'. The WSDL document contains links that could not be resolved. There was an error downloading 'http://ServerMachineName:500/ITCAMSWebService_deploy/Services/Authentication.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://ServerMachineName:500/ITCAMSWebService_deploy/Services/Authentication.svc'. Content Type application/soap+xml; charset=utf-8 was not supported by service http://ServerMachineName:500/ITCAMSWebService_deploy/Services/Authentication.svc . 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.

在服務器Web.config中

生成服務模型部分如下:

<system.serviceModel> 
     <services> 
      <service name="Authentication" behaviorConfiguration="Behavior_Authentication"> 
       <host> 
        <baseAddresses> 
         <add baseAddress="http://ServerMachineName:500/ITCAMSWebService_deploy/Services/Authentication.svc"></add> 
        </baseAddresses> 
       </host> 
       <endpoint address="" contract="IAuthentication" binding="basicHttpBinding" bindingConfiguration="ITCAMSWebService.IAuthentication" /> 

      </service> 
     </services> 
    <behaviors> 


     <serviceBehaviors> 
     <behavior> 
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
      <serviceMetadata httpGetEnabled="true" /> 
      <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
      <serviceDebug includeExceptionDetailInFaults="true" /> 
      <dataContractSerializer maxItemsInObjectGraph="2147483646" /> 
     </behavior> 
     </serviceBehaviors> 


    </behaviors> 
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" /> 
    </system.serviceModel> 
+0

如果您有權訪問服務器,請在wcf服務的配置中啓用跟蹤。它會告訴你到底發生了什麼問題。 –

回答

1

已解決!!!在服務器上添加Everyone用戶對C:\ Windows \ Temp的完全權限。 IIS需要在服務器上的Temp文件夾中生成元數據文件的權限。

+0

其實你只需要給IIS寫入權限(IIS_USERS)http://stackoverflow.com/a/4120815/96505。但是,在開發機器上充分利用每個人都可以完成這項工作 –

0

請給你的服務器在地址而不是ServerMachineName的IP地址,並檢查兩個客戶端服務器的綁定

+0

什麼需要檢查綁定? –

+0

檢查您在服務器中給出的綁定... basicHttpBinding或WsHttpBinding?同樣應該給客戶端 – user416

+0

我用web.config編輯我的問題。我是WCF部署中的新成員。這部分需要添加什麼? –

相關問題