在IIS中托管wcf双工服务
问题描述:
我可以托管IIS的“正常”basichttp服务并通过本地网络访问它。 问题是,我试图做一个双工服务,并在IIS中托管它。在IIS中托管wcf双工服务
我的web.config:
<system.serviceModel>
<services>
<service behaviorConfiguration="BaseBehavior" name="RegistrationService">
<endpoint binding="wsDualHttpBinding" bindingConfiguration="wsDualHttpBind" name="RegistrationService" contract="Service" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="BaseBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsDualHttpBinding>
<binding name="wsDualHttpBind" sendTimeout="00:01:00">
<security mode="None">
<message clientCredentialType="None" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
错误消息我得到当我打开的 “http://本地主机/Service/Service.svc”:
“合同要求 “双面” 结合“basicHttpBinding的“不支持此功能,并且支持配置不正确。”
我用Google搜索,发现不同的设置web.config中,但没有奏效。 我的猜测是,在web.config是错误的。
答
谢谢您的快速回复。我的配置是完全错误的^^
看完这篇文章:
http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,b891610a-6b78-4b54-b9a6-4ec81c82b7c0.aspx
我从wsDualHttpBinding改变的net.tcp。
我的新web.config文件看起来是这样的:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MyBehaviour">
<serviceMetadata />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="Service" behaviorConfiguration="MyBehaviour">
<endpoint address=""
binding="netTcpBinding"
bindingConfiguration="InsecureTcp"
contract="IService" />
<endpoint address="mextcp" binding="mexTcpBinding" contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="InsecureTcp" portSharingEnabled="true">
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
和IIS我添加的net.tcp网站。 (http,net.tpc) 并且防火墙必须允许这些端口。
现在工作。
答
首先,你应该有一个Service.svc指向你的服务的实现。 然后,在服务条目中,如果没有程序集,请尝试指定完整名称(您在Service.svc文件的Service属性中使用的名称),如果它位于单独的项目中。 最后,使用合同属性的实施服务合同的全名(此处省略汇编)。 端点的名称不应该很重要。