Reputation: 281
I have created an OData/WCF service using Visual Studio 2010 on Windows XP SP3 with all current patches installed.
When I click on "view in browser", the service opens and I see the 3 tables from my EF model. However, when I add a table name ("Commands" in this case) to the end of the query string, rather than seeing the data from the table, I get an HTTP 500 error. (This error (HTTP 500 Internal Server Error) means that the website you are visiting had a server problem which prevented the webpage from displaying.).
I have not only followed the examples from 2 sites, but have also tried running the sample application that the blog poster sent me (that works on his machine), and still am not having any luck.
The blog post is at Exposing OData from an Entity Framework Model
Does anyone have an idea why this is occurring and how to resolve it?
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
- <service xml:base="http://localhost:1883/VistaDBCommandService.svc/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns="http://www.w3.org/2007/app">
- <workspace>
<atom:title>Default</atom:title>
- <collection href="Commands">
<atom:title>Commands</atom:title>
</collection>
- <collection href="Databases">
<atom:title>Databases</atom:title>
</collection>
- <collection href="Statuses">
<atom:title>Statuses</atom:title>
</collection>
</workspace>
</service>
In an effort to get this working, I have:
After all of this, I am still getting the same HTTP 500 error, with no entries of any kind in the Event Viewer.
Any other ideas?
Upvotes: 12
Views: 14900
Reputation: 13320
Please try these debugging tips to see the actual error which happened: Link
Upvotes: 5
Reputation: 9540
Received similar output with VS2013:
Resolved by upgrading the Entity Framework.
See answer https://stackoverflow.com/a/21028123/2116188.
Upvotes: 2
Reputation: 31
If you are using SQL Server Compact data file (Like NorthWind.sdf) you need to give write file permission to IUSRS group.
Ex: If you are using NorthWind.sdf in DataDirectory i.e. YourWeb/App_Data then you need to give write permissions to _IUSRS group from IIS Console or from Windows Explorer.
Upvotes: 0
Reputation: 31
You can also activate Failed Request Tracing for your Web Application in IIS
then you will get detailled trace execution in Xml files from IIS when a 500 error occurs
There is a good article here explaining how to setup Failed Request Tracing in IIS :
Using Failed Request Tracing to Trace Rewrite Rules
HTH Cédric
Upvotes: 1
Reputation: 1256
config.UseVerboseErrors=true;
helped me in finding out the problem. The problem was I was using windows authentication for database connection. After changing to SQL Server Authentication everything worked fine.
Upvotes: 5
Reputation: 281
I figured out that my problem was an issue with opening the database. The way I figured it out was to add the following to the servicename.svc.cs file in the InitializeService method:
config.UseVerboseErrors=true;
Thanks to all who tried to help.
Eric
Upvotes: 16
Reputation: 161831
500
always means there was an unhandled exception in the service. Go look in the windows event log to see what that error was.
Upvotes: 2