在类库中引用了WCF服务,悲剧降临了,追踪日志看到下边一串:

------------------------------------------------------------------------------

出错时间: 2015/1/22 14:54:40
出错信息: 在 ServiceModel 客户端配置部分中,找不到引用协定“WiseUC.functionsPortType”的默认终结点元素。这可能是因为未找到应用程序的配置文件,或者是因为客户端元素中找不到与此协定匹配的终结点元素。
详细信息: 在 System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)
在 System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName, Configuration configuration)
在 System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName)
在 System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)
在 System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
在 System.ServiceModel.EndpointTrait`1.CreateSimplexFactory()
在 System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait)
在 System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef()
在 System.ServiceModel.ClientBase`1..ctor()
在 ServiceContentInstantMessengerWiseUC.WiseUC.functionsPortTypeClient..ctor() 位置 D:\2.hWorking\电子政务平台\trunk\04.源代码\框架后台服务\服务内容\ServiceContentInstantMessengerWiseUC\Service References\WiseUC\Reference.cs:行号 243
在 FrameWorkService.Imp.ContentInstantMessengerWiseUC.bSpellInfoParameter(String cSenderName, String cReceiverNames, String cInfoTitle, String cInfoContent, String cLinkUrl, String cSendStyle, String cKeyCode, String cServiceUrl) 位置 D:\2.hWorking\电子政务平台\trunk\04.源代码\框架后台服务\服务内容\ServiceContentInstantMessengerWiseUC\ContentInstantMessengerWiseUC.cs:行号 242
在 FrameWorkService.Imp.ContentInstantMessengerWiseUC.SendMessage(String sender_userID, String acceptor_userID, String message) 位置 D:\2.hWorking\电子政务平台\trunk\04.源代码\框架后台服务\服务内容\ServiceContentInstantMessengerWiseUC\ContentInstantMessengerWiseUC.cs:行号 97

-------------------------------------------------------------------------------------------------------

说得很明白,是因为“未找到应用程序的配置文件,或者是因为客户端元素中找不到与此协定匹配的终结点元素”,可这句话几乎等于一句废话,因为我曾经信了这句话,将类库中的.config文件中的复制到了主程序中(就是那个有Main函数的.exe程序)的.config文件中,当时是管用了,但后来我又在另一个类库中引用了同样的WCF服务,但是悲剧再次降临。

 1 <system.serviceModel>
 2         <bindings>
 3             <basicHttpBinding>
 4                 <binding name="functionsBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
 5                     receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
 6                     bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
 7                     maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
 8                     messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
 9                     useDefaultWebProxy="true">
10                     <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
11                         maxBytesPerRead="4096" maxNameTableCharCount="16384" />
12                     <security mode="None">
13                         <transport clientCredentialType="None" proxyCredentialType="None"
14                             realm="" />
15                         <message clientCredentialType="UserName" algorithmSuite="Default" />
16                     </security>
17                 </binding>
18             </basicHttpBinding>
19         </bindings>
20         <client>
21             <endpoint address="http://192.168.3.188:14132/Interface/www/soap/stdserver.php?wsdl"
22                 binding="basicHttpBinding" bindingConfiguration="functionsBinding"
23                 contract="WiseUC.functionsPortType" name="functionsPort" />
24         </client>
25     </system.serviceModel>
View Code

相关文章:

  • 2022-01-21
  • 2021-06-21
  • 2022-12-23
  • 2021-10-12
  • 2022-02-17
  • 2021-11-15
  • 2021-05-19
猜你喜欢
  • 2022-12-23
  • 2021-08-15
  • 2022-03-09
  • 2022-12-23
  • 2022-02-26
  • 2022-12-23
相关资源
相似解决方案