将 WCF 从自托管移植到 IIS/AppFabric 托管
我有一个 WCF,它在自托管文件中绑定了 TCP、HTTP 和 Mex,一切都运行良好。但是,我想将其迁移到 AppFabric,并保留相同的绑定,但我很难做到这一点。我添加了 WCF 服务应用程序,更正了 svc 文件,删除了自托管控制台应用程序,但我不断收到可怕的 无法找到与绑定 NetTcpBinding 的端点的方案 net.tcp 相匹配的基地址。注册的基地址方案是[http]
。错误。为了使其正常工作,我应该从 app.config 到 web.config 文件进行哪些更改?我什至还没有尝试在 IIS 上发布它...我收到的这个错误来自 VS 的 Web 服务器
以下是我之前用于自托管的 app.config 文件:
<configuration>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<bindings>
<basicHttpBinding>
<binding name="SimpleBinding" />
</basicHttpBinding>
<netTcpBinding>
<binding name="DefaultTCPBinding" closeTimeout="01:00:00" receiveTimeout="01:00:00"
sendTimeout="01:00:00" transactionFlow="true" transactionProtocol="OleTransactions"
maxBufferSize="5242880" maxReceivedMessageSize="5242880">
<reliableSession inactivityTimeout="01:00:00" />
</binding>
</netTcpBinding>
<wsHttpBinding>
<binding name="RSAlarmEvent" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
<webHttpBinding>
<binding name="ScriptBindig" crossDomainScriptAccessEnabled="true" />
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="WebScriptBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="MetadataBehavior">
<serviceMetadata httpGetEnabled="true" httpGetBinding="webHttpBinding"
httpGetBindingConfiguration="" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentCalls="64" maxConcurrentSessions="400"
maxConcurrentInstances="464" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="MetadataBehavior" name="MyServer.Implementation.MyAppImplementation">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="DefaultTCPBinding"
name="MyAppTCPEndpoint" contract="MyServer.Interfaces.IMyApp" />
<endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
name="MyAppMex" contract="IMetadataExchange" />
<endpoint address="ws" behaviorConfiguration="" binding="basicHttpBinding"
bindingConfiguration="SimpleBinding" name="MyApp" contract="MyServer.Interfaces.IMyApp" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://desk01:9878/MyAppService" />
<add baseAddress="http://desk01:9876/MyAppService/" />
</baseAddresses>
</host>
</service>
</services>
<diagnostics>
<messageLogging logEntireMessage="true"
logMalformedMessages="true"
logMessagesAtTransportLevel="true" />
</diagnostics>
</system.serviceModel>
</configuration>
我需要更改什么?
塔克斯
I have a WCF that has a TCP, HTTP and Mex binding in a self-hosted file, and everything works great. However, and I want to migrate it over to AppFabric, and keep the same bindings, but I'm having a very hard time doing it. I added the WCF Service Application, corrected the svc file, drop the Self-Hosting console application, but I keep getting the awfull Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http]
. error. What changes should I promote from my app.config to my web.config file in order to get this working? I haven't even tried to publish it on IIS, yet... this error that I'm getting is from VS's web server
Below is my previous app.config file for the self-hosting:
<configuration>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<bindings>
<basicHttpBinding>
<binding name="SimpleBinding" />
</basicHttpBinding>
<netTcpBinding>
<binding name="DefaultTCPBinding" closeTimeout="01:00:00" receiveTimeout="01:00:00"
sendTimeout="01:00:00" transactionFlow="true" transactionProtocol="OleTransactions"
maxBufferSize="5242880" maxReceivedMessageSize="5242880">
<reliableSession inactivityTimeout="01:00:00" />
</binding>
</netTcpBinding>
<wsHttpBinding>
<binding name="RSAlarmEvent" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
<webHttpBinding>
<binding name="ScriptBindig" crossDomainScriptAccessEnabled="true" />
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="WebScriptBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="MetadataBehavior">
<serviceMetadata httpGetEnabled="true" httpGetBinding="webHttpBinding"
httpGetBindingConfiguration="" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentCalls="64" maxConcurrentSessions="400"
maxConcurrentInstances="464" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="MetadataBehavior" name="MyServer.Implementation.MyAppImplementation">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="DefaultTCPBinding"
name="MyAppTCPEndpoint" contract="MyServer.Interfaces.IMyApp" />
<endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
name="MyAppMex" contract="IMetadataExchange" />
<endpoint address="ws" behaviorConfiguration="" binding="basicHttpBinding"
bindingConfiguration="SimpleBinding" name="MyApp" contract="MyServer.Interfaces.IMyApp" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://desk01:9878/MyAppService" />
<add baseAddress="http://desk01:9876/MyAppService/" />
</baseAddresses>
</host>
</service>
</services>
<diagnostics>
<messageLogging logEntireMessage="true"
logMalformedMessages="true"
logMessagesAtTransportLevel="true" />
</diagnostics>
</system.serviceModel>
</configuration>
What do I need to change?
Tks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
IIS 本身无法托管非 HTTP 端点。您还必须安装(激活功能)Windows 激活服务 (WAS)。安装后,您必须在 IIS 管理控制台中为您的站点启用 net.tcp 绑定。
IIS alone is not able to host non HTTP endpoints. You must also install (activate feature) Windows Activation Service (WAS). Once installed you must enable net.tcp binding for your site in IIS management console.