根据微软的建议,对于soap1.1,soap1.2,基于休息,即json,xml,它可以从web配置进行配置。因此,Web配置将根据地址决定服务。但不能正常工作。请建议。
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5.1"/>
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<services>
<service name="PaymentService.Service1">
<endpoint address="soapbasic" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding" behaviorConfiguration="SampleServiceBehavior" contract="PaymentService.IService1" />
<endpoint address="json" binding="webHttpBinding" bindingConfiguration="webHttpBindingJson" behaviorConfiguration="jsonBehavior" contract="PaymentService.IService1"/>
<endpoint address="xml" binding="webHttpBinding" bindingConfiguration="webHttpBindingXml" behaviorConfiguration="poxBehavior" contract="PaymentService.IService1"/>
<endpoint address="soapWs" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding" contract="PaymentService.IService1"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="SampleServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="True" />
<serviceCredentials useIdentityConfiguration="false" />
</behavior>
<behavior name="SampleServiceBehaviorSOAP">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="jsonBehavior">
<enableWebScript/>
</behavior>
<behavior name="poxBehavior">
<enableWebScript/>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding">
<security mode="None" />
</binding>
</basicHttpBinding>
<webHttpBinding>
<binding name="webHttpBindingJson">
<security mode="None"/>
</binding>
<binding name="webHttpBindingXml">
<security mode="None"/>
</binding>
</webHttpBinding>
<wsHttpBinding>
<binding name="wsHttpBinding">
<security mode="None"/>
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
</configuration>
答案 0 :(得分:0)
由于您已配置多个端点,我认为您必须定义<baseAddress>
- 节点。
您是否已尝试仅使用一个端点配置该服务(理想情况为basicHttpBinding
)?这样,您就可以逐步尝试使用其他端点来增强服务。
另一个好主意是将svclog
添加到<system.diagnostics>
节点中,这可能会提供其他错误详细信息。看看这个:http://msdn.microsoft.com/en-us/library/ms733025(v=vs.110).aspx
错误是由配置错误引起的。解决方案是将behaviorConfiguration
- 属性放在正确的位置。
答案 1 :(得分:0)
通过在服务中添加behaviorConfiguration =“SampleServiceBehavior”,即&lt; service name =“PaymentService.Service1”behaviorConfiguration =“SampleServiceBehavior”&gt; 已解决问题。感谢你的回答。
答案 2 :(得分:0)
在做完这个之后,我面临另一个问题,休息和肥皂。这是服务中发现的多个终点。为了解决这个问题,应该在终点ex&lt;端点名称=&#34; wsSoap&#34; 地址=&#34; soapWs&#34;结合=&#34;的wsHttpBinding&#34; bindingConfiguration =&#34;的wsHttpBinding&#34;合同=&#34; PaymentService.IService1&#34; /取代。 我添加了另一个答案,如果用户遇到这种问题,如果他们的多个终点成功运作。