error无法处理消息,因为内容类型'application / json'不是预期类型'text / xml;字符集= UTF-8'

时间:2016-12-29 07:04:58

标签: asp.net wcf

当使用firebug时,我收到了这个有线错误“NetworkError:415无法在我的asp.net项目中处理... xt / xml; charset = utf-8。

界面在

之下
[OperationContract]     
    [FaultContract(typeof(string))]
    [WebInvoke(Method="POST",  
        UriTemplate="Demand",
        BodyStyle = WebMessageBodyStyle.Bare,
        ResponseFormat=WebMessageFormat.Json)]

    ClientResponse postdemand_data(List<demands> demanddata);

网络配置。我们在服务中使用以下Web配置文件

<system.web>
    <compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="LargeWebforHttp" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
                <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
            </binding>
            <binding name="LargeWebforHttps" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
                <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
                <security mode="Transport">
                    <transport clientCredentialType="None"/>
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <behaviors>
        <serviceBehaviors>
            <behavior name="DPintegrationHA_FromSR.Service1Behavior">
                <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" httpsGetUrl="" />
                <serviceThrottling maxConcurrentCalls="10000" maxConcurrentSessions="10000"
            maxConcurrentInstances="10000" />
                <dataContractSerializer maxItemsInObjectGraph="2147483647" />
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <services>
        <service behaviorConfiguration="DPintegrationHA_FromSR.Service1Behavior" name="DP_ITAPEDGE_HMview_wcf.Service1">
            <endpoint address="" binding="basicHttpBinding" bindingConfiguration="LargeWebforHttp" contract="DP_ITAPEDGE_HMview_wcf.IService1" name="httpPoint">
            </endpoint>
            <endpoint address="" binding="basicHttpBinding" bindingConfiguration="LargeWebforHttps" contract="DP_ITAPEDGE_HMview_wcf.IService1" name="httpsPoint">
            </endpoint>
            <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
        </service>
    </services>
</system.serviceModel>

0 个答案:

没有答案