Tôi có một máy chủ bên App.config sau cho một dịch vụ WCF:WCF maxReceivedMessageSize không được đọc từ cấu hình
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="default" maxReceivedMessageSize="5000000">
<readerQuotas maxStringContentLength="5000000" maxArrayLength="5000000" />
</binding>
</wsHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="Core.TOAService.Service1Behavior"
name="Core.TOAService.TOAService">
<endpoint address="" binding="wsHttpBinding" contract="Core.TOAService.ITOAService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/Core.TOAService/TOAService/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Core.TOAService.Service1Behavior">
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="True"/>
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Khi tôi cố gắng và vượt qua dịch vụ này một file largish (chỉ ~ 250KB), tôi nhận được một ngoại lệ đã đăng nhập vào tệp svclog:
Giới hạn kích thước thư tối đa cho thông báo gửi đến (65536) đã bị vượt quá . Để tăng hạn ngạch, hãy sử dụng thuộc tính MaxReceivedMessageSize trên yếu tố ràng buộc phù hợp.
Như bạn có thể thấy từ phần ràng buộc ở đầu cấu hình, tôi đã cố đặt maxReceivedMessageSize thành 5000000 nhưng dịch vụ vẫn cho rằng nó được đặt thành 65536 mặc định. hoặc yếu tố ràng buộc "thích hợp" là gì?
Có, bạn phải tham khảo cấu hình liên kết. Thay đổi bộ đệm có thể không cần thiết. –
Nó không bao giờ khá rõ ràng nếu và trong đó ba thay đổi bộ đệm là thực sự cần thiết - nó giúp để thử, và xem. Có thực sự không có tài liệu, giải thích và tài liệu toàn diện tốt về cách tinh chỉnh các cài đặt đó, thật không may .... –
Doh, máy chủ của tôi thích hợp để sử dụng VS2010 để xây dựng một dịch vụ 3.5! Rất cám ơn, đó là cố định nó. –