- 在客户端配置部分中,找不到引用协定的默认终结点元素。
解决方法:可能是主程序的App.config中没有引用外部webservice。需要把引用webservice的类库工程中的app.config中的以下部分
<system.serviceModel>
省略
</system.serviceModel>
粘贴到主程序的App.config文件中。
- 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 及其依赖都被当前工程所引用。然后勾选这个复选框。
- 已超过传入消息(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>