2016-10-07 45 views
0

我知道「HTTP 413請求實體太大」錯誤是常見問題解答。但是我有一個變化,我現在已經弄不清兩天了。我已經創建了一個WCF服務端點作爲本地SharePoint 2013應用程序的一部分(請參閱下文)。該網站啓用SSL,我得到了413錯誤。我已經嘗試增加網站web.config中的maxReceivedMessageSize,通過與此錯誤相關的許多帖子以及通過IIS管理器/站點/管理/配置編輯器修改站點本身的標誌。但似乎沒有任何工作。我可以發佈沒有問題的小文件。我的猜測是,也許的SharePoint做一些事情來覆蓋約束力,我需要在不同的地方向SharePoint Web服務發佈HTTP 413錯誤

服務合同

​​

的web.config

<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> 
應用 maxReceivedMessageSize變化

回答

0

還有更多必須設置的配置,請嘗試設置:

<system.web> 
    <httpRuntime maxRequestLength="2147483647" /> 
</system.web> 

並添加到您的綁定:

<webHttpBinding> 
    <binding name="webBinding" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" maxBufferSize="2147483647"> 
     <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" /> 
     <security mode="Transport"></security>   
    </binding> 
</webHttpBinding> 
+0

不幸的是,這並不適合我。由於我已經看到廣泛討論這個修復,我想知道這是否特定於SharePoint,也許我只是沒有在正確的地方進行更改。我有一個VS Project,它定義了生成SharePoint WSP的服務。我已經在我的項目 – SylverSmyth

+0

下的app.config中設置了它,我可以看到更改應用在bin/project.dll.config文件中。但是我不太瞭解當WSP部署到SharePoint Web應用程序時,配置會發生什麼。它可能嵌入在網站內容的某個地方嗎?如果是這樣,我如何驗證綁定更改正確應用? – SylverSmyth

0

我能夠通過創建/修改爲我在SharePoint服務的綁定來解決這個問題。我通過執行以下PowerShell腳本執行此操作:

$contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService; 
$contentService.ClientRequestServiceSettings.MaxReceivedMessageSize = -1 
$wcfServiceSettings = New-Object Microsoft.SharePoint.Administration.SPWcfServiceSettings 
$wcfServiceSettings.ReaderQuotasMaxStringContentLength = 2147483647 
$wcfServiceSettings.ReaderQuotasMaxArrayLength = 2147483647 
$wcfServiceSettings.ReaderQuotasMaxBytesPerRead = 2147483647 
$wcfServiceSettings.MaxReceivedMessageSize = 2147483647 
$wcfServiceSettings.MaxBufferSize = 2147483647 
$wcfServiceSettings.ReaderQuotasMaxDepth = 2147483647 
$wcfServiceSettings.ReaderQuotasMaxNameTableCharCount = 2147483647 
$contentService.WcfServiceSettings["<my service name>.svc"] = $wcfServiceSettings 
$contentService.Update($true) 

這樣做的效果與原始響應者所建議的一樣。但它解決了Web服務是SP應用程序一部分的特殊情況下的問題。

相關問題