WCF 4和多端点绑定
我希望能够公开与basicHttpBinding和webHttpBinding相同的合同和服务,以便能够进行POST调用。不知何故,当我查看wsdl时,它从未看到webHttpBinding的端点。我做错了什么WCF 4和多端点绑定,wcf,wcf-binding,wcf-4,Wcf,Wcf Binding,Wcf 4,我希望能够公开与basicHttpBinding和webHttpBinding相同的合同和服务,以便能够进行POST调用。不知何故,当我查看wsdl时,它从未看到webHttpBinding的端点。我做错了什么 <system.serviceModel> <services> <service name="MyService"> <endpoint address ="" binding="basicHttpBin
<system.serviceModel>
<services>
<service name="MyService">
<endpoint address =""
binding="basicHttpBinding"
name="EndpointBasic"
contract="IMyService"/>
<endpoint address ="PostMethod"
binding="webHttpBinding"
name="EndpointJson"
contract="IMyService"/>
<host>
<baseAddresses>
<add baseAddress ="http://localhost/WebsiteName/MyService.svc"/>
</baseAddresses>
</host>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="basicBinding" />
</basicHttpBinding>
<webHttpBinding>
<binding name="Postbinding"
maxBufferSize="65536"
maxReceivedMessageSize="2000000000"
transferMode="Streamed">
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="JsonBehavior">
<webHttp defaultOutgoingResponseFormat="Json" />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
谢谢 我有以下服务元素条目,可用于SOAP和REST:
<service name="XMLService.RestAndSoapService" behaviorConfiguration="default">
<endpoint address="" behaviorConfiguration="web" binding="webHttpBinding" bindingConfiguration="RestBinding" name="SampleService" contract="XMLService.IRestAndSoapService" />
<endpoint address="soap" binding="basicHttpBinding" bindingConfiguration="noSecurity" contract="XMLService.IRestAndSoapService" />
</service>
在配置中需要注意的要点:
<service name="namespace.MyService">
<endpoint address =""
bindingConfiguration="basicBinding"
binding="basicHttpBinding"
name="EndpointBasic"
contract="namespace.IMyService"/>
<endpoint address ="PostMethod"
bindingConfiguration="Postbinding"
binding="webHttpBinding"
name="EndpointJson"
contract="namespace.IMyService"/>
<host>
<baseAddresses>
<add baseAddress ="http://localhost/WebsiteName/MyService.svc"/>
</baseAddresses>
</host>
</service>
我还想提一下,我想从一个html页面为这个webhttpbinding调用一篇帖子。。。另外,如果您希望应用“JsonBehavior”,请将behaviorConfiguration=“JsonBehavior”
属性添加到“PostMethod”端点元素中。好的,这似乎起到了作用。。。然而,当我转到我得到一个页面,说端点未找到。nm。。。我想我忘了PostMethod是地址。。除此之外,我还需要添加操作。嗯