WCF IIS 服务器配置 [英] WCF IIS server configuration

查看:29
本文介绍了WCF IIS 服务器配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

<上一页>该文件已被理解,但无法处理.- WSDL 文档包含无法解析的链接.- 下载http://sbkisourcedev01/VCIndex/Calculator.svc?xsd=xsd0"时出错.- 底层连接已关闭:接收时发生意外错误.- 无法从传输连接读取数据:现有连接被远程主机强行关闭.- 现有连接被远程主机强行关闭元数据包含无法解析的引用:http://sbkisourcedev01/VCIndex/Calculator.svc?wsdl".内容类型应用程序/soap+xml;服务 http://sbkisourcedev01/VCIndex/Calculator.svc?wsdl 不支持 charset=utf-8.客户端和服务绑定可能不匹配.远程服务器返回错误:(415)无法处理消息,因为内容类型'application/soap+xml;charset=utf-8' 不是预期的类型 'text/xml;字符集=utf-8'..如果在当前解决方案中定义了服务,请尝试构建解决方案并再次添加服务引用.

我在 Windows 7 上运行此服务,没问题.所以我相信我的 W2K8 IIS 配置设置有问题.

这是我的配置文件:

 <system.serviceModel><绑定><基本的HttpBinding><绑定名称="basicHttpBindingConfig"/></basicHttpBinding></绑定><行为><服务行为><行为名称="服务行为"><serviceMetadata httpGetEnabled="true"/><serviceDebug includeExceptionDetailInFaults="true"/></行为></服务行为></行为><serviceHostingEnvironment multipleSiteBindingsEnabled="true"/><服务><服务行为配置=服务行为"name="WCFVCIndex.Calculator"><端点地址=""绑定="基本HttpBinding"合同="WCFVCIndex.ICalculator"bindingConfiguration="basicHttpBindingConfig"/><端点地址="mex"绑定="mexHttpBinding"合同="IMetadataExchange"/></服务></服务></system.serviceModel>

提前致谢.

解决方案

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

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.

解决方案

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% emp folder. After changing that permission to my identity (LOCAL SERVICE) on C:WindowsTemp I was able to add service reference to WCF service.

这篇关于WCF IIS 服务器配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆