引用service reference时遇到的一些错误

  1. 在客户端配置部分中,找不到引用协定的默认终结点元素。

解决方法:可能是主程序的App.config中没有引用外部webservice。需要把引用webservice的类库工程中的app.config中的以下部分

<system.serviceModel>

省略

</system.serviceModel>

粘贴到主程序的App.config文件中。

 

  1. Service Reference Error: Failed to generate code for the service reference。

解决方法:这可能是由于在引用webservice时采用了reuse typein reference assemblies. 可以通过禁用来解决。右击添加的webservice -> configure service  reference->Data Type下面去掉Reuse type in reference assemblies 的复选框。如果确实需要使用引用的assemblies, 需要确保webservice中的要用到的dll 及其依赖都被当前工程所引用。然后勾选这个复选框。

 

  1. 已超过传入消息(65536)的最大消息大小配额。若要增加配额,请使用相应绑定元素上的MaxReceivedMessageSize 属性。

解决方法:加上红色部分即可。

<?xmlversion="1.0" encoding="utf-8" ?>

<configuration>

    <system.serviceModel>

        <bindings>

           <wsHttpBinding>

             <binding name="WSHttpBinding_ISyncService" maxBufferPoolSize="2147483647"maxReceivedMessageSize="2147483647" >

                <readerQuotas maxDepth="32"maxStringContentLength="2147483647"maxArrayLength="2147483647"

       maxBytesPerRead="2147483647"maxNameTableCharCount="2147483647" />

             </binding>

           </wsHttpBinding>

        </bindings>

        <client>

           <endpoint address="http://localhost:8732/SyncService/"binding="wsHttpBinding"

               bindingConfiguration="WSHttpBinding_ISyncService"contract="SyncServiceProxy.ISyncService"

               name="WSHttpBinding_ISyncService">

           </endpoint>

        </client>

    </system.serviceModel>

</configuration>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值