ADO.NET Data Services in an ASP.NET-MVC project
-
06-07-2019 - |
Question
I'm trying to add an ADO.NET data service to a vanilla ASP.NET-MVC project. Does anyone know if these technologies are compatible?
When I Ctrl+f5 the solution and visit the service URL all I get when is the very unhelpful "Request Error ... See server logs" page. Does the Development Web server even write any logs and if so where?
I guessed that routing may be the problem so I added:-
routes.IgnoreRoute("{service}.svc/{*pathInfo}");
in an attempt to fix this but that doesn't help.
I would rather not create a separate ASP.NET Web project just to host the data service. Are there other steps to addiing a Data service in an ASP.NET-MVC project that are not common to standard ASP.NET project?
Solution
Did you place debugging atribute into service class ?
**[System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)]**
public class MyDataService : DataService<...>
{
// This method is called only once to initialize service-wide policies.
public static void InitializeService(IDataServiceConfiguration config)
{
// TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
// Examples:
config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
**config.UseVerboseErrors = true;**
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow