2013-02-06 181 views
2

我是WCF的新手。我正在尋找步驟來在IIS上部署WCF並使用該服務。 我按照相同的步驟在IIS上部署網站,同時將默認文檔設置爲Service1.svc在IIS 7.5中部署WCF服務

現在,當我嘗試使用此wcf服務時,它給了我以下錯誤。

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

Follwing在Web.Config文件我的服務詳情

<system.serviceModel> 
    <services> 
     <service behaviorConfiguration="DemoWCF.Service1Behavior" name="DemoWCF.Service1"> 
     <host> 
      <baseAddresses> 
      <add baseAddress="http://localhost:8000/Service1.svc"/> 
      </baseAddresses> 
     </host> 
     <endpoint address="http://localhost:8000/Service1.svc" 
        binding="basicHttpBinding" 
        contract="DemoWCF.IService1" 
        bindingConfiguration="basicBinding"> 
      <identity> 
      <dns value="localhost"/> 
      </identity> 
     </endpoint> 
     <endpoint address="mex" 
        binding="mexHttpBinding" 
        contract="IMetadataExchange" /> 
     </service> 
    </services> 

    <bindings> 
     <basicHttpBinding> 
     <binding name="basicBinding" textEncoding="utf-8"></binding> 
     </basicHttpBinding> 
    </bindings> 

    <behaviors> 
     <serviceBehaviors> 
     <behavior name="DemoWCF.Service1Behavior"> 
      <serviceMetadata httpGetEnabled="True" /> 
      <serviceDebug includeExceptionDetailInFaults="false" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    </system.serviceModel> 

請指引我,我欠缺的,並做出了哪些措施。 謝謝。

回答

5

在google上搜索並觀看視頻後。最後我得到了解決方案。

發生此錯誤是由於IIS配置,我沒有打擾。

  1. 打開您的IIS管理器控制檯。
  2. 製作一個單獨的應用程序池。 a)。將.NET Framework版本設置爲4.0
    b)。管理流水線模式:經典
  3. 將應用程序池標識設置爲「本地系統」。
  4. 按照與在IIS上部署Web應用程序相似的步驟,如創建虛擬目錄。
  5. 創建您已創建的應用程序池的虛擬目錄。

並使用客戶端應用程序中的WCF服務。

Click here to watch the video

請更新此問題/答案線程,如果你發現更多關於這一點。
謝謝:)

+2

讓整個應用池作爲「LocalSystem」運行是相當安全的風險。 –