WCF Service netTCPbinding

╄→尐↘猪︶ㄣ 提交于 2019-12-01 00:55:03

问题


I want to use netTCPbinding, so I've changed my web config as below. I'm experiencing this error:

Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http].

How can this be solved?

<services>
  <service name="DXDirectory.DXDirectoryService" behaviorConfiguration="DXDirectory.Service1Behavior">
    <!-- Service Endpoints -->
    <endpoint address="" binding="netTcpBinding" bindingConfiguration="WindowsSecured" contract="DXDirectory.IDXDirectoryService">
      <!-- 
          Upon deployment, the following identity element should be removed or replaced to reflect the 
          identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
          automatically.
      -->
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <host>
      <baseAddresses>
        <add baseAddress="net.tcp://localhost:2582/DXDirectoryService" />
      </baseAddresses>
    </host>

  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="DXDirectory.Service1Behavior">
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="false" />
      <!-- 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" />
      <serviceAuthorization principalPermissionMode="UseWindowsGroups" />
      <!--<serviceCredentials>-->
        <!--<userNameAuthentication userNamePasswordValidationMode="Custom"
                                membershipProviderName="CustomUserNameValidator"/>-->
      <!--</serviceCredentials>-->
    </behavior>
  </serviceBehaviors>
</behaviors>

回答1:


HMm... you've added the base address to your services/host section ok.

Quick question: are you self-hosting, or hosting in IIS ?? Which version of IIS ??

IIS5/6 only support HTTP connections - you cannot host a NetTCP in IIS 5/6.

In IIS7, you have to manually go through a series of steps to enable non-HTTP bindings, but it's possible. See this MSDN article on how to achieve this.

Self-hosting is the best option - you get all bindings and are in total control of your service being hosted.

Marc




回答2:


Here is a NetTcpBinding basic example from msdn. See if this can help you.

EDIT:

And here is a related SO question.




回答3:


I cant see section in your config file, can u please please add this

<netTcpBinding>

 <binding name="WindowsSecured">
 <security mode="none"/> 
 </binding> 

</netTcpBinding>



来源:https://stackoverflow.com/questions/1356739/wcf-service-nettcpbinding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!