开发者

IIS 7.0 using netTcpBinding

I've been trying for more than a week without any success at all, to host wcf service using netTcpBinding.

With http, everything is ok. But with tcp problems arise.

I have performed all the steps I'm supposed to, in order to host my service in WAS:

.Net 3.0 Features are enabled, including http and non-http Activation

. At IIS Manager/ Manage Web Site / Advanced Settings, both, http and net.tcp protocols are enabled. -I also add net tcp to site binding

When i run the webservice, i have this exception : Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http].

Here's what my Web.Config looks like:

   <services>
        <service name="Services.Library.OrderService"  BehaviorConfiguration="OrderServiceBehavior">
            <!-- Service Endpoints -->
            <endpoint  address="WSOrder.svc" 
                        binding="netTcpBinding"
                        bindingConfiguration="netTcpStreaming"
                        name="NetTcpBindingEndpoint"
                        contract="Services.Interface.IOrderService" >


                <identity>
        <dns value="localhost" />
      </identity>

            </endpoint>

            <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>

            <host>
                <baseAddresses>
                    <add baseAddress="net.tcp://localhost:808/" />                  
                </baseAddresses>
            </host>


        </service>
    </services>

    <behaviors>
        <serviceBehaviors>
            <behavior name="OrderServiceBehavior">
                <!-- 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" />
                <dataContractSerializer maxItemsInObjectGraph="6553600" />
            </behavior>
        </serviceBehaviors>
    </behaviors>

    <bindings>
        <netTcpBinding>
            <binding name="netTcpStreaming"
                     openTimeout="10:00:00"
                     closeTimeout="10:00:00" 
                     receiveTimeout="10:00:00"
                     sendTimeout="10:00:00"
                     maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" >

                <!-- this is for demo only. Https/Transport security is recommended -->
                <security mode="None" />
            </binding>
         </netTcpBinding>

    </bindings>

Can you tell me please what is wrong with my code?

Thanks in advan开发者_如何学Pythonce


If you want mex, you have to have an http endpoint defined whether you use it or not.

drop the mex and your service should work just fine.

here is a working net.tcp binding from one of my integration tests.... compare it to what you have..

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
 <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MyServiceBehavior">
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service name="WcfServiceLibrary1.Service">
        <endpoint address="service" binding="netTcpBinding" contract="WcfServiceShared.IService" name="TcpBinding" />
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:8000/ServiceHost/" />
          </baseAddresses>
        </host>
      </service>
    </services>
  </system.serviceModel>
</configuration>


I've been having similar issues myself recently, but eventually managed to get things working.

You say "At IIS Manager/ Manage Web Site / Advanced Settings, both, http and net.tcp protocols are enabled. -I also add net tcp to site binding". This setting also needs to be manually set at the sub "virtual root" level if there is one. Is this running under a virtual root in IIS? If so, check this setting there.

Have you also set the bindings at the web site level "edit bindings"? You'll need to add a net.tcp binding here. In your case:

Type: net.tcp
Binding Information: 808:*

If both of those fail, post back. I'll keep an eye out :)

[Edit in response to your comments]

OK - I've had a closer look at your config and it doesn't look right to me. This is the server side config? [ie not for a calling client]

I've recreated a config, based on yours, for you to experiment with. [I've stripped out the mex stuff - just a barebones tcp binding]

Have you been using the WCF Service Configuration Editor to generate this config, or have you been doing it by hand? If by hand, don't - use the config editor. It saves lives!

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding name="netTcpStreaming" closeTimeout="00:10:00" openTimeout="00:10:00"
            sendTimeout="00:10:00" maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
            maxReceivedMessageSize="2147483647">
          <security mode="None" />
        </binding>
      </netTcpBinding>
    </bindings>
    <services>
      <service name="Services.Library.OrderService">
        <endpoint address="net.tcp://localhost:808/" binding="netTcpBinding"
          bindingConfiguration="netTcpStreaming" contract="Services.Interface.IOrderService" />
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:808/" />
          </baseAddresses>
        </host>
      </service>
    </services>
  </system.serviceModel>
</configuration>


This is totally a guess but you may want to try futzing with this code:

<baseAddresses>
    <add baseAddress="net.tcp://localhost:808/" />                  
</baseAddresses>

Maybe change net.tcp to http

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜