如何更改WCF服务的绑定

时间:2013-09-24 01:23:27

标签: wcf wcf-binding wcf-security

我有一个非常简单的(参见任何在线示例)wcf服务库。我可以通过localhost上的WCF测试客户端exe运行它。但是当通过另一个客户端工具(如soapUI)访问它时,我会收到错误。我相信这些错误与服务的安全配置有关。

如何更改服务的绑定,如本文所述:

"Invalid or expired security context token" when running after a debugging restart

这是在app.config还是web.config中。我的项目甚至没有web.config。

这是我的app.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <system.web>
    <compilation debug="true" />
  </system.web>
  <!-- When deploying the service library project, the content of the config file must be added to the host's 
  app.config file. System.Configuration does not support config files for libraries. -->
  <system.serviceModel>
    <services>
      <service name="NorthwindServices.ProductService">
        <host>
          <baseAddresses>
            <add baseAddress = "http://localhost:8732/Design_Time_Addresses/NorthwindServices/ProductService/" />
          </baseAddresses>
        </host>
        <endpoint address ="" binding="wsHttpBinding"
                            contract="NorthwindServices.IProducts">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding"
                    contract="IMetadataExchange"/>
      </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="False" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

</configuration>

0 个答案:

没有答案