• TroubleShoot:SilverLight中Wcf调用时出现Not Found等错误


    一、错误描述:
    由于项目才接触WCF,配置及调试的过程中,出现的错误,搞的头大,现综合下原因及解决方案。
    调用时返回Not Found、Request Failed等错误。

    二、项目环境:
    SharePoint 2010、SilverLight 4、Sql 2008、Ado.net、WCF

    三、错误原因:
    一般是在SharePoint上使用时,易出现以下问题:
    1、出现跨域问题
    2、大数据量传递问题
    3、请求超时问题
    4、传递实体类不能序列化问题

    四、解决方案:
    1、添加clientaccesspolicy.xml文件放在IIS的根目录或应用程序下;检查SL中生成的配置文件xxx.ClientConfig 中endpoint address 是否正确
    <?xml version="1.0" encoding="utf-8"?>
    <access-policy>
        
    <cross-domain-access>
            
    <policy>
                
    <allow-from http-request-headers="*">
                    
    <domain uri="*"/>
                
    </allow-from>
                
    <grant-to>
                    
    <resource path="/" include-subpaths="true"/>
                
    </grant-to>
            
    </policy>
        
    </cross-domain-access>
    </access-policy>

    2、3、这三个的解决方法可以通过修改Web.Config来解决。
    <bindings>
        
    <basicHttpBinding>
           
    <binding name="BasicHttpBinding_IDataService"
                   hostNameComparisonMode
    ="StrongWildcard"
                   receiveTimeout
    ="00:10:00"
                   sendTimeout
    ="00:10:00"
                   openTimeout
    ="00:10:00"
                   closeTimeout
    ="00:10:00"
                   maxReceivedMessageSize
    ="65536"
                   maxBufferSize
    ="65536"
                   maxBufferPoolSize
    ="524288"
                   transferMode
    ="Buffered"
                   messageEncoding
    ="Text"
                   textEncoding
    ="utf-8"
                   bypassProxyOnLocal
    ="false"
                   useDefaultWebProxy
    ="true" >
            
    <readerQuotas
                
    maxArrayLength="2147483647"
                 maxBytesPerRead
    ="2147483647"
                 maxDepth
    ="2147483647"
                 maxNameTableCharCount
    ="2147483647"
                 maxStringContentLength
    ="2147483647" />
          
    </binding>
        
    </basicHttpBinding>
      
    </bindings>

    4、接的在实体类字段添加[DataMember]

    出处: http://www.cnblogs.com/windy2008

  • 相关阅读:
    开源协议
    markdown 语法和工具
    mac 终端 使用ftp命令
    谷歌囧大了!安统镜卓5.0刷入遇到system.img系像找不到
    linux下vi命令大全
    python编码处理:unicode字节串转成中文 各种字符串举例说明
    优秀前端资源备忘录
    mousewheel滚轮事件
    bootstrap插件之Carousel
    初识Node.js
  • 原文地址:https://www.cnblogs.com/windy2008/p/1965408.html
Copyright © 2020-2023  润新知