使用netTCP绑定在IIS中托管的WCF服务

时间:2009-09-23 20:34:28

标签: wcf wcf-binding wcf-client

我在IIS7中托管了一个启用了netTCP的WCF服务。

这是我在%apppath%\中的web.config,其中SVC文件是。

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <services>
      <service name="Search.Querier.WCF.Querier" behaviorConfiguration="SearcherServiceBehavior">
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8050/SearcherService"/>
          </baseAddresses>
        </host>
        <endpoint address="net.tcp://localhost:9000/SearcherService"
                  binding="netTcpBinding"
                  bindingConfiguration="Binding1"
                  contract="Search.Querier.WCF.IQuerier" />
      </service>
    </services>
    <bindings>
      <netTcpBinding>
        <binding name="Binding1"
                     hostNameComparisonMode="StrongWildcard"
                     sendTimeout="00:10:00"
                     maxReceivedMessageSize="65536"
                     transferMode="Buffered"
                     portSharingEnabled="false">
          <security mode="None">
            <transport clientCredentialType="None" />
            <message clientCredentialType="None" />
          </security>
        </binding>
      </netTcpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="SearcherServiceBehavior">
          <serviceMetadata httpGetEnabled="true" httpGetUrl=""/>
          <serviceDebug includeExceptionDetailInFaults="true"  />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
  <system.web>
    <compilation debug="true" />
  </system.web>
</configuration>

出于某种原因,我没有像我指定的那样在端口8050上加载,而是看到显示该网站的蓝色和米色网站:

http://localhost/SearcherService/searcherservice.svc 并不是 http://localhost:8050/SearcherService/searcherservice.svc

此外,当我尝试运行

svcutil.exe http://process.mycomp.com/SearcherService/SearcherService.svc?wsdl

当URL上显示的页面显示时,我收到错误:

Metadata contains a reference that cannot be resolved: 'http://process.mycomp.com/SearcherService/SearcherService.svc?wsdl'

但我在web.config

中没有指定其他地方

它还有其他地方吗?

1 个答案:

答案 0 :(得分:2)