2013-02-06 180 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”运行是相当安全的风险。 –