ASP.NET web应用程序中WCF服务库与DAL的连接问题

ASP.NET web应用程序中WCF服务库与DAL的连接问题,asp.net,wcf,dll,Asp.net,Wcf,Dll,我在同一个解决方案中设置了以下内容 具有一个名为MatchService.cs的主服务的WCF服务库 带有EntityDataModel的DAL,用于my类,该类从数据库检索有关足球比赛的信息 承载WCF服务库匹配服务的ASP.NET网站(来自上述WCF服务库) 我的问题是,这个fine在本地运行,但不在生产服务器上运行。在本地,WCF项目有一个app.config,它从中获取DB DAL的连接详细信息,但是我认为这不会被放入WCF服务项目的已编译的.dll中,因为我在将其上载到生产站点时遇

我在同一个解决方案中设置了以下内容

  • 具有一个名为MatchService.cs的主服务的WCF服务库
  • 带有EntityDataModel的DAL,用于my类,该类从数据库检索有关足球比赛的信息
  • 承载WCF服务库匹配服务的ASP.NET网站(来自上述WCF服务库)
我的问题是,这个fine在本地运行,但不在生产服务器上运行。在本地,WCF项目有一个app.config,它从中获取DB DAL的连接详细信息,但是我认为这不会被放入WCF服务项目的已编译的.dll中,因为我在将其上载到生产站点时遇到以下错误:

通信对象System.ServiceModel.Channels.ServiceChannel无法用于通信,因为它处于故障状态

因此,我认为它会尝试从web.config获取数据库详细信息,但情况似乎并非如此

有人能告诉我我做错了什么吗

编辑:

我现在已经删除了所有访问DAL的尝试,当服务位于托管环境中时,Im仍然无法通过WCF测试客户端访问该服务。WCF测试客户端位于我的本地计算机上。我可以获得显示在WCF测试客户端中的方法,但是当我尝试调用其中一个方法时,会出现以下错误:

The caller was not authenticated by the service.

Server stack trace: 
   at System.ServiceModel.Security.IssuanceTokenProviderBase`1.DoNegotiation(TimeSpan timeout)
   at System.ServiceModel.Security.SspiNegotiationTokenProvider.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Security.CommunicationObjectSecurityTokenProvider.Open(TimeSpan timeout)
   at System.ServiceModel.Security.SymmetricSecurityProtocol.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.SecurityChannelFactory`1.ClientSecurityChannel`1.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.DoOperation(SecuritySessionOperation operation, EndpointAddress target, Uri via, SecurityToken currentToken, TimeSpan timeout)
   at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.GetTokenCore(TimeSpan timeout)
   at System.IdentityModel.Selectors.SecurityTokenProvider.GetToken(TimeSpan timeout)
   at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecuritySessionChannel.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
   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)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at IMatchService.GetMatches()
   at MatchServiceClient.GetMatches()

Inner Exception:
The request for security token could not be satisfied because authentication failed.
   at System.ServiceModel.Security.SecurityUtils.ThrowIfNegotiationFault(Message message, EndpointAddress target)
   at System.ServiceModel.Security.SspiNegotiationTokenProvider.GetNextOutgoingMessageBody(Message incomingMessage, SspiNegotiationTokenProviderState sspiState)

检查,看起来是您的问题。

您是否能够通过浏览器导航到WCF服务?获取端点地址,看看它是否会出现在浏览器中。是的,我可以在浏览器中导航到该服务,但是我无法访问浏览器中的方法?我不能把地址放在这里,但我可以传递任何需要的信息。你的servicemodel配置位需要在你的托管项目的web.config中。是吗?是的,它们已经就位了。当我从服务中删除所有尝试的DB访问,并通过代码手动添加一些项目,然后上载服务时,我就一点问题也没有了。当它试图使用DAL通过WCF服务库检索DB项时,就会出现这种情况。你能试试这个吗?谢谢你,但我已经摆脱了所有的使用语句,它没有帮助吗?虽然这可以从理论上回答这个问题,但你可以在回答中包含链接文章的基本部分,并提供链接供参考。如果做不到这一点,答案将面临链接腐烂的风险。