500 interbnal server error

I followed the first sample c# code provided in http://docs.servicestack.net/create-your-first-webservice. The service without the route attribute works. Once I add the Route attribute I get a 500 internal server error.

Where can I check what the error is?

What could be causing this error?

I am using VS 2012

You’ll have to inspect the raw HTTP Traffic using something like Chrome Web Inspector or Fiddler to find more details about the error. Also set DebugMode = true if not already.

Although I’m a bit confused you’ve used the .NET Core tag but say you’re using VS 2012? Note many of the VS.NET templates in ServiceStackVS require VS 2013+. But why not just use the latest VS 2017 Community Edition?

My solution is in VS2012. So I am bound to it for now.

Will the latest version of SS not work on VS2012? If not do I have to use an earlier version of SS?

I enabled debug. I do notsee any useful info in Fiddler

HTTP/1.1 500 Internal Server Error
Cache-Control: private
Content-Type: text/plain;charset=UTF-8
Vary: Accept
Server: Microsoft-IIS/8.0
X-Powered-By: ServiceStack/4.512 NET45 Win32NT/.NET
X-AspNet-Version: 4.0.30319
X-SourceFiles: =?UTF-8?B?QzpcRmlsZXNcUHJvamVjdHNcTmF2bWFuXEZ1c29cQ29kZVxXZWIgQXBwbGljYXRpb25zXEN1c3RvbWVyU2VydmljZVxUZXN0XGQ=?=
X-Powered-By: ASP.NET
Date: Mon, 28 Aug 2017 02:53:53 GMT
Content-Length: 0

Is there anywhere else I can look at to see what the error is.

I get the error only if I use the Route attribute. If I remove it, it works just fine.

ServiceStack itself should still work since it’s still running on .NET 4.5, but you may need to create your Web Project from an Empty ASP.NET project.

Check to see if you have any Startup Errors in your Metadata page which might be causing the issue.

Otherwise what does your complete Service + Route definition look like?

1 Like

I started from blank ASP.NET project. I am sorry if I poseted my question to the wrong queue.

There are no startup errors. Attached is screen shot.

The route attributes I have set ar
[Route("/Test")]
[Route("/Test/{Name}")]

If I use the default end point it works. If I add /Test or /Test/testname they both give this error.

I have not added any other references to my project yet. Want to get this first basic method to work before I write my other methods.

Should I see 500 errors in event log?

Can you share the solution you’ve created? Do you start it from Visual Studio or publish to IIS first and then run?

You can enable logging to event log by adding this line to Configure method

LogManager.LogFactory = new EventLogFactory("Logging.Tests", "Application");

also if you run from Visual Studio you can get ServiceStack debugging information in application output pane by enabling debug logs:

LogManager.LogFactory = new DebugLogFactory(debugEnabled:true);