开发者

WCF help, how can I expose a service over http, that calls another service over net.tcp?

I have a WCF .svc file hosted in IIS. I want to use basicHTTP binding. This services job is to actually call another service over net.tcp. Everything works fine locally, but when I deployed, I'm getting this error.

The provided URI scheme 'http' is invalid; expected 'net.tcp'. Parameter name: via

Here is the server config

<client>
  <endpoint address="net.tcp://localhost:9300/InternalInterfaceService"
      binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IInternalInterfaceService"
      contract="IInternalInterfaceService" name="NetTcpBinding_IInternalInterfaceService">
    <identity>
      <servicePrincipalName value="localhost" />
    </identity>
  </endpoint>
</client>
<services>
<service name="MyExternalService">
<endpoint address="" binding="basicHttpBinding" contract="IMyExternalService" />
</service>
</services>

And here is the config that svcutil generates

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_IMyExternalService" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <security mode="None">
                    <transport clientCredentialType="None" proxyCredentialType="None"
                        realm="" />
                    <message clientCredentialType="UserName" algorithmSuite="Default" />
                </security>
           开发者_StackOverflow中文版 </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://myserver.somesdomain.com/Services/MyExternalService.svc"
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyExternalService"
            contract="IMyInternalService" name="BasicHttpBinding_IMyExternalService" />
    </client>
</system.serviceModel>

What do I need to do to wire this up correctly. I do not want to expose InternalInterfaceService over http. What am I doing incorrectly here? Any tips or suggestions are certainly appreciated.

Thanks,

~ck


You need a routing service - one that exposes a HTTP endpoint to the world, and uses netTcp internally.

Basically, your outward facing http service must become a client in turn to call the internal netTcp service.

You can definitely do this in .NET 3.5 with a bit of effort:

  • Service Station: Building a WCF Router, Part 1
  • Service Station: Building a WCF Router, Part 2

or you can use the new WCF 4 Routing Service in .NET 4 / VS 2010:

  • Creating Routing Service using WCF 4.0, .NET Framework 4.0 and Visual Studio 2010
  • WCF in .NET 4 the WCF Routing service
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜