我新建了1个wcf项目,和一个web应用程序,web应用程序调用wcf没任何错误我现在想把调用那部分程序单独脱离出来建个类库访问的时候就出错,出
在 ServiceModel 客户端配置部分中,找不到引用协定“ServiceReference1.IUpLoadService”的默认终结点元素。这可能是因为未找到应用程序的配置文件,或者是因为客户端元素中找不到与此协定匹配的终结点元素。 这错误调用的方法都是同1个,只是第一个是在web应用程序里调用,出错的是在类库里调用
有人知道如何在类库中访问wcf
在 ServiceModel 客户端配置部分中,找不到引用协定“ServiceReference1.IUpLoadService”的默认终结点元素。这可能是因为未找到应用程序的配置文件,或者是因为客户端元素中找不到与此协定匹配的终结点元素。 这错误调用的方法都是同1个,只是第一个是在web应用程序里调用,出错的是在类库里调用
有人知道如何在类库中访问wcf
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IUpLoadService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="9223372036854775807"
messageEncoding="Mtom" textEncoding="utf-8" transferMode="Streamed"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://www.ddddddd.com/UpLoadService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IUpLoadService"
contract="UpLoadService.IUpLoadService" name="BasicHttpBinding_IUpLoadService" />
</client>
</system.serviceModel>
</configuration>
或者,你可以试试从解决方案中发现WCF服务引用的方法来调用.
<system.serviceModel>
省略
</system.serviceModel>复制然后粘贴到主程序(Main函数所在工程)的app.config文件中的<configuration></configuration>中。
具体可以
参考www.cnblogs.com/mail-ricklee中的FortuneBase