我知道“HTTP 413 请求实体太大”错误是一个常见问题解答。但是我有一个变化,我已经两天无法弄清楚了。我已经创建了一个 WCF 服务端点作为本地 SharePoint 2013 应用程序的一部分(见下文)。该网站已启用 SSL,但我收到 413 错误。我已经尝试maxReceivedMessageSize
根据与此错误相关的许多帖子增加站点 web.config 以及通过 IIS 管理器/站点/管理/配置编辑器修改站点本身的标志。但似乎没有任何效果。我可以毫无问题地发布小文件。我的猜测是,也许 SharePoint 做了一些事情来覆盖绑定,我需要maxReceivedMessageSize
在不同的地方应用更改
服务合同
[ServiceContract]
public interface ISharepointService
{
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "UploadFile?partner={partnerid}&location={locationid}&filename={filename}&type={type}&period={period}")]
void UploadFile(string partnerid, string locationid, string filename, string type, string period, Stream stream);*
网络配置
<services>
<service behaviorConfiguration="serviceBehavior" name="MyCompany.Sharepoint.MyService.SharepointServiceApp">
<endpoint address="Sharepoint" behaviorConfiguration="webBehavior" binding="webHttpBinding" bindingConfiguration="webBinding" contract="MyCompany.Sharepoint.MyService.SharepointServiceApp"></endpoint>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="webBinding" maxReceivedMessageSize="2147483647">
<security mode="Transport">
</security>
</binding>
</webHttpBinding>
</bindings>