wcf rest服务出现以下问题
我正试图从浏览器访问此端点
https://localhost:443/Service1.svc/json/GetCustomerData/ABC US,ABC UK/MQA/
ABC US、ABC UK是逗号分隔的字符串参数
问题是,当我在本地尝试时,它运行得很好,但当我在远程主机上尝试时,浏览器只显示页面无法显示。我不确定是否需要在iis上进行一些设置。
我在iis上托管该服务。
这是来自远程iis 的响应
失败
https://remoteserver:443/Service1.svc/json/GetCustomerData/ABC US,ABC UK/MQA/
写入日志的错误为对象图中可以序列化或反序列化的最大项数为"65536"。更改对象图或增加MaxItemsInObjectGraph配额。
我认为这也是一种误导。此外,我正在使用自签名证书
传递(因为逗号分隔的值被删除,并且只传递一个参数)
https://remoteserver:443/Service1.svc/json/GetCustomerData/ABC UK/MQA/
以下是我的代码
[OperationContract]
[WebInvoke(Method = "GET", UriTemplate = "GetCustomerData/{postcode}/{dept}", ResponseFormat = WebMessageFormat.Json)]
IEnumerable<Customer> GetCustomerData(string postcode, string dept);
//interface implementation
IEnumerable<Customer> GetCustomerData(string postcode, string dept);
{
return new Customer
{
Name = "Customer 1",
Add1 = "Address Line 1"
...etc
};
}
以下是我使用的配置
<system.serviceModel>
<services>
<service name="Service1" behaviorConfiguration="httpsBehavior">
<endpoint address="json" binding="webHttpBinding" contract="ICustomerData" behaviorConfiguration="web"
bindingConfiguration="webHttpBindingTransportSecurity"/>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="webHttpBindingTransportSecurity" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
<security mode="Transport" />
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="httpsBehavior">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
任何帮助都将不胜感激
这是我在配置行为中对其进行排序的更改,
<behaviors>
<serviceBehaviors>
<behavior name="httpsBehavior">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
基本上从endpointBehaviors移动到serviceBehaviors