删除net.tcp中的.svc扩展名

时间:2012-08-25 20:37:18

标签: wcf iis wcf-binding was svc

我正在尝试在WAS和IIS中为http和net.tcp托管我的WCF 4 Web服务。是否可以删除net.tcp绑定的.svc扩展名?

如果我执行以下操作,则会收到错误

  

没有终点收听   net.tcp://myserver.com/service/TestService可以   接受消息。这通常是由不正确的地址或   SOAP动作。有关更多详细信息,请参阅InnerException(如果存在)。

 <system.serviceModel>
      <serviceHostingEnvironment multipleSiteBindingsEnabled="true">
          <serviceActivations>
              <add relativeAddress="TestService.svc" service="Web.TestService"/>
          </serviceActivations>   
      </serviceHostingEnvironment>     




      <services>
          <service name="Web.TestService" behaviorConfiguration="WebService">
              <host>
                  <baseAddresses>
                      <add baseAddress="http://myserver.com/service/" />

                  </baseAddresses>

              </host>
              <endpoint address=""  contract="Web.ITestService" binding="basicHttpBinding"></endpoint>
              <endpoint address="net.tcp://myserver.com:808/service/TestService" contract="Web.ITestService" binding="netTcpBinding"></endpoint>
              <endpoint address="net.tcp://myserver.com:808/service/TestService/mex"  binding="mexTcpBinding" bindingConfiguration="" contract="IMetadataExchange"></endpoint>
          </service>
      </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="WebService">                       
          <serviceMetadata httpGetEnabled="true"/>            
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>   
  </system.serviceModel>

1 个答案:

答案 0 :(得分:0)

Nazaf这些行导致错误,因为您的地址不正确,您有两个协议。

baseAddress="http://myserver.com/service/"
+
<endpoint address="net.tcp://myserver.com:808/service/TestService" contract="Web.ITestService" binding="netTcpBinding"></endpoint>

您的地址中有两个协议,删除基地址并设置不同的值

你可以阅读这篇关于解决它的非常紧迫的文章: http://msdn.microsoft.com/en-us/magazine/cc163412.aspx