Welcome to MSDN Blogs Sign in | Join | Help
How to see detailed error messages when browsing a Data Service (Astoria).

How to see detailed error messages when browsing a Data Service.

 

Initial Error message on browsing the service

The server encountered an error processing the request. See server logs for more details.

 

Above Error message makes it difficult to troubleshoot the cause of failure of the service.

We add following attribute to the DataServices class.

[System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)]

And browse the service http://localhost:51651/ConsumeEDM.svc/

Now the error message is a below.

Error

The server encountered an error processing the request. The exception message is 'The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.'. See server logs for more details. The exception stack trace is:

at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) at System.Data.EntityClient.EntityConnection..ctor(String connectionString) at System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString) at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName) at EDM.TestEntities..ctor() in d:\practise\dataservicesprj\edm\test.designer.cs:line 26 at invoke_constructor() at System.Data.Services.DataService`1.CreateDataSource() at System.Data.Services.DataService`1.EnsureProviderAndConfigForRequest() at System.Data.Services.DataService`1.ProcessRequestForMessage(Stream messageBody) at SyncInvokeProcessRequestForMessage(Object , Object[] , Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

 

From the above message we come to know that the datServices is not having a appropriate connection string in the web.config file, we were trying to consume a ADO.net Entity Data model in our service so we can use the same connection string as used in the Entity model project.

Copy it in the web.config file of the project having our Data Service.

<connectionStrings>

    <add name="TestEntities" connectionString="metadata=res://*/Test.csdl|res://*/Test.ssdl|res://*/Test.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.;Initial Catalog=Test;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />

  </connectionStrings>

And this time around  we are able to browse the data service successfully.

 

 

Posted: Friday, July 17, 2009 11:37 PM by ambujnautiyal

Comments

No Comments

Anonymous comments are disabled
Page view tracker