【发布时间】:2011-09-29 18:31:58
【问题描述】:
我有 WCF RESTful 服务和 Android 客户端。
当我提出更大的请求时,服务器回复 400。看来我有 65k 限制问题,例如 在here 或其他百万个关于相同问题的帖子中。
但是,我似乎无法修复它。这是我的 web.config 的外观
<system.serviceModel>
<diagnostics>
<messageLogging logMalformedMessages="true" logMessagesAtServiceLevel="true"
logMessagesAtTransportLevel="true" />
</diagnostics>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint name="myEndpoint" helpEnabled="true" automaticFormatSelectionEnabled="true" maxReceivedMessageSize="1000000" />
</webHttpEndpoint>
</standardEndpoints>
</system.serviceModel>
这是服务功能的代码示例:
[WebInvoke(UriTemplate = "/trips/{TripId}/inspection", Method = "POST")]
[Description("Used on mobile devices to submit inspections to server")]
public void PostTripInspection(string tripId, Inspection inspection)
{
return;
}
这是托管 WCF (Global.asax.cs) 的 Web 项目中的代码
private static void RegisterRoutes()
{
// Setup URL's for each customer
using (var cmc = new CoreModelContext())
{
foreach (var account in cmc.Accounts.Where(aa => aa.IsActive).ToList())
{
RouteTable.Routes.Add(
new ServiceRoute(
account.AccountId + "/mobile", new WebServiceHostFactory(), typeof(MobileService)));
}
}
}
据我了解,Java HttpClient 没有施加任何限制,因此它在 WCF 方面。有关如何解决此问题或如何在 WCF 中拦截消息的任何指示?
编辑 2: 这就是跟踪显示的内容。当我修改标准端点时,它没有帮助......
【问题讨论】: