WCF IIS 服务器配置

发布于 2024-11-19 21:38:15 字数 2585 浏览 3 评论 0原文

我有带有 IIS7 的 Windows Server 2008 R2。我在上面部署了WCF服务。当我在浏览器(本地或外部计算机)中指定 WCF 服务地址时 http://sbkisourcedev01/VCIndex/Calculator.svc ?wsdl 我在浏览器中获取服务描述。但是,当我尝试将对项目的引用添加到该服务时,我收到以下错误:

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>

提前致谢。

I have Windows Server 2008 R2 with IIS7 on it. I deployed WCF service on it. When I specify WCF service address in browser (local or external machine) http://sbkisourcedev01/VCIndex/Calculator.svc?wsdl I am getting service description in browser. However when I am trying to add reference to the project to that service I am getting following error:

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.

I have this service running on Windows 7 and it is okay. So I believe there is something with my W2K8 IIS configuration settings.

Here is my config file:

  <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>

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

稀香 2024-11-26 21:38:16

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

The problem was with WCF identity permissions. The identity that is used for the application pool that hosts the WCF service must have full NTFS permissions on the %WINDIR%\temp folder. After changing that permission to my identity (LOCAL SERVICE) on C:\Windows\Temp I was able to add service reference to WCF service.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文