title: WCF Service Library Connection Issue to DAL in an ASP.NET web application
body: <p>I have the following set up in the same solution.</p>
  
  <ul>
  <li>A WCF Services Library with one main service called MatchService.cs</li>
  <li>A DAL with a EntityDataModel for my classes which retrieves my information about football matches from a DB</li>
  <li>An ASP.NET Website which is hosting the WCF Service Library Match Service (from the WCF service libracy mentioned above)</li>
  </ul>
  
  <p>My problem is that this fine runs locally, but not on the production server. Locally the WCF project has an app.config from which it gets the connection details for the DB DAL, however I'm thinking that this does not get put into the compiled .dll for the WCF Services Project as I get the following error when I upload this to the production site:</p>
  
  <p>"The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state."</p>
  
  <p>So I thought it would attempt to get the DB details from the web.config, however this does not seem to be the case either.</p>
  
  <p>Can anyone let me know what I'm doing wrong?</p>
  
  <p>EDIT:</p>
  
  <p>I have now removed all attempts to access the DAL and Im still not able to access the service via the WCF test client when the service is on the hosted environment. The WCF test client is on my local machine. I can get the methods to appear in the WCF Test client however when I try to invoke one of them I get the following error:</p>
  
  <pre><code>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&amp; 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)
  </code></pre>