Failed to invoke the service.可能的原因:服务离线或不可访问;客户端配置与代理不匹配;现有代理无效。请参考堆栈跟踪以获取更多详细信息。您可以尝试通过启动新的代理、恢复默认配置或刷新服务来恢复。
堆栈跟踪错误详细信息
由于内部错误,服务器无法处理请求。有关错误的更多信息,请在服务器上启用IncludeExceptionDetailInFaults(从ServiceBehaviorAttribute或配置行为)以将异常信息发送回客户端,或按照Microsoft .NET Framework 3.0 SDK文档中的说明开启跟踪并检查服务器跟踪日志。
服务器堆栈跟踪: at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter) at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
异常被重新抛出[0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at IUserService.GetUser(String UserID) at UserServiceClient.GetUser(String UserID)
以下是源代码:
app.config file from wcfservicelirbrary
<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.web> <compilation debug="true" /> </system.web> <system.serviceModel> <services> <service name="UserServiceLibrary.UserService"> <endpoint address="" binding="wsHttpBinding" contract="UserServiceLibrary.IUserService"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> <host> <baseAddresses> <add baseAddress="http://localhost:8732/Design_Time_Addresses/UserServiceLibrary/UserService/" /> </baseAddresses> </host> </service> </services> <behaviors> <serviceBehaviors> <behavior> <serviceMetadata httpGetEnabled="True"/> <serviceDebug includeExceptionDetailInFaults="False" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> </configuration>
Web config file from WCF Website Host
<?xml version="1.0"?> <configuration> <system.web> <compilation debug="false" targetFramework="4.0" /> </system.web> <system.serviceModel> <services> <service name="UserServiceLibrary.UserService"> <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="" contract="IMetadataExchange" /> <endpoint address="basic" binding="basicHttpBinding" bindingConfiguration="" contract="UserServiceLibrary.IUserService" /> <endpoint address="" binding="wsHttpBinding" contract="UserServiceLibrary.IUserService" /> </service> </services> <behaviors> <serviceBehaviors> <behavior> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="false"/> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> </system.webServer> </configuration>
UserServiceClient.GetUser(String UserID)
- 这就是异常最初发生的地方。发布你的代码和从dotnetnate的建议中获得的任何其他信息,以获得更好的答案 :) - Tim