多个绑定配置SOAP和JSON

时间:2013-09-13 21:56:30

标签: c# json wcf soap

我尝试使用相同的wcf契约类实现soap和json方法。我的问题是,当我在服务名称删除名称空间前缀(XXXX)时,soap方法正常工作但json方法不正常。如果我保留命名空间,这次json方法正常工作,但肥皂方法抛出错误。

我的配置是这样的;任何想法?

感谢所有人。

<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"></serviceHostingEnvironment> 
            <behaviors>
                <serviceBehaviors>
                    <behavior name="ServiceBehavior">
                        <serviceMetadata  httpGetEnabled="true" />
                        <serviceDebug  includeExceptionDetailInFaults="true"  />
                    </behavior>        
                </serviceBehaviors>

          <endpointBehaviors >
                    <behavior name="JsonEndPointBehavior">
                        <webHttp />
                    </behavior>
            <behavior name="SoapEndPointBehavior">          
            </behavior>
                </endpointBehaviors>

            </behaviors>
            <services>
                <service behaviorConfiguration="ServiceBehavior" name="XXXX.ServerSide">

            <endpoint address=""                   
                      binding="webHttpBinding" 
                      contract="XXXX.service.IServerSide" 
                      behaviorConfiguration="JsonEndPointBehavior" />

            <endpoint address="soap"                    
                      binding="basicHttpBinding" 
                      contract="XXXX.IServerSide" 
                      behaviorConfiguration="SoapEndPointBehavior"/>
          </service>   

0 个答案:

没有答案