binding.MaxBufferSize = 2147483647
binding.MaxReceivedMessageSize = 2147483647
然后考虑修改ServiceReferences.ClIEntConfig文件,增加Buffer 尺寸。
Code
<bindings>
<basichttpBinding>
<binding name="BasichttpBinding_IDataService"
maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
</basichttpBinding>
</bindings>
但是,WCF仍旧报错。 最后,尝试修改服务器端,在Web.config中添加自定义BasichttpBinding对象,
Code
<bindings>
<basichttpBinding>
<binding name="BasichttpBinding_IDataService"
maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647"
maxBufferSize="2147483647">
<readerQuotas
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxDepth="2147483647"
maxnametableCharCount="2147483647"
maxStringContentLength="2147483647" />
</binding>
</basichttpBinding>
</bindings>
另外,在ServiceBehaviors中添加maxItemsInObjectGraph属性
Code
<behaviors>
<serviceBehaviors>
<behavior name="TeacherLogic.Net.Web.DataServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDeBUG includeExceptionDetailinFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
添加自定义Binding对象后,在endpoint中引用,就解决了“NotFound”问题了。 < endpoint address ="" binding ="basichttpBinding" contract ="Myproject.IDataService" bindingConfiguration ="BasichttpBinding_IDataService" /> 在Silverlight官方论坛还有一种说法,因为404 Notfound错误的,还可能因为跨域问题,这个问题比较容易解决,只要在网站根目录下建立一个clIEntaccesspolicy.xml文件即可。 Code
<?xml version="1.0" enCoding="utf-8" ?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="http://*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy> 摘自: http://www.voidcn.com/article/p-dckmunki-bke.html 总结
以上是内存溢出为你收集整理的Silverlight + WCF错误“The remote server returned an error: NotFound.”的解决方法全部内容,希望文章能够帮你解决Silverlight + WCF错误“The remote server returned an error: NotFound.”的解决方法所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)