tag:support.appharbor.com,2010-11-23:/discussions/problems/4822-internal-server-error-500-mvc-4-web-apiAppHarbor: Discussion 2018-10-19T03:06:43Ztag:support.appharbor.com,2010-11-23:Comment/165590212012-06-10T09:48:18Z2012-06-10T09:48:19ZInternal server Error 500 MVC 4 Web API<div><p>Hi. I deploy MVC 4 Web API project to AppHarbor. Project using
.NET Framework 4.0. Project work correct locally. Build from Harbor
work correct locally too. But I have Internal server error <a href=
"http://mobilevizorapi.apphb.com/api/Platforms">http://mobilevizorapi.apphb.com/api/Platforms</a>.</p></div>lubushyntag:support.appharbor.com,2010-11-23:Comment/165590212012-06-10T18:57:30Z2012-06-10T18:57:30ZInternal server Error 500 MVC 4 Web API<div><p>Hi,</p>
<p>I've inserted the exception I'm seeing below - you might need to
bin-deploy another MVC4 assembly?</p>
<p>Best,<br>
Rune</p>
<p><br>
System.TypeLoadException<br>
<br>
Could not load type
'System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption'
from assembly 'System.ComponentModel.DataAnnotations,
Version=4.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35'.<br>
<br>
<br>
Server stack trace: at
System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly
assembly, ObjectHandleOnStack retTypes) at
System.Reflection.RuntimeAssembly.GetExportedTypes() at
System.Web.Http.Dispatcher.DefaultHttpControllerTypeResolver.GetControllerTypes(IAssembliesResolver
assembliesResolver) at
System.Web.Http.WebHost.WebHostHttpControllerTypeResolver.GetControllerTypes(IAssembliesResolver
assembliesResolver) at
System.Web.Http.Dispatcher.HttpControllerTypeCache.InitializeCache()
at System.Lazy<code>1.CreateValue() Exception rethrown at [0]: at
System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly
assembly, ObjectHandleOnStack retTypes) at
System.Reflection.RuntimeAssembly.GetExportedTypes() at
System.Web.Http.Dispatcher.DefaultHttpControllerTypeResolver.GetControllerTypes(IAssembliesResolver
assembliesResolver) at
System.Web.Http.WebHost.WebHostHttpControllerTypeResolver.GetControllerTypes(IAssembliesResolver
assembliesResolver) at
System.Web.Http.Dispatcher.HttpControllerTypeCache.InitializeCache()
at System.Lazy</code>1.CreateValue() at
System.Lazy<code>1.LazyInitValue() at
System.Lazy</code>1.get_Value() at
System.Web.Http.Dispatcher.HttpControllerTypeCache.get_Cache() at
System.Web.Http.Dispatcher.DefaultHttpControllerSelector.InitializeControllerInfoCache()
at System.Lazy<code>1.CreateValue() Exception rethrown at [1]: at
System.Lazy</code>1.get_Value() at
System.Web.Http.Dispatcher.DefaultHttpControllerSelector.SelectController(HttpRequestMessage
request) at
System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsyncInternal(HttpRequestMessage
request, CancellationToken cancellationToken) at
System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(HttpRequestMessage
request, CancellationToken cancellationToken)<br>
<br></p></div>runetag:support.appharbor.com,2010-11-23:Comment/165590212012-06-10T19:08:44Z2012-06-10T19:08:44ZInternal server Error 500 MVC 4 Web API<div><p>A am adding this assembly System.ComponentModel.DataAnnotations
to build but it's can't halp to me.</p></div>lubushyntag:support.appharbor.com,2010-11-23:Comment/165590212012-06-10T19:17:35Z2012-06-10T19:17:35ZInternal server Error 500 MVC 4 Web API<div><p>Hmm can you possibly try and uninstall MVC4 from your local
machine? Then you'll be able to see if any of those assemblies are
missing anyways.</p>
<p>I'm wondering if what you're trying to use may be contained in a
different assembly.</p>
<p>Best,<br>
Rune</p></div>runetag:support.appharbor.com,2010-11-23:Comment/165590212012-06-10T19:18:42Z2012-06-10T19:18:42ZInternal server Error 500 MVC 4 Web API<div><p>Just wanted to add that we'll of course install MVC4 when it
becomes RTM.</p>
<p>Best,<br>
Rune</p></div>runetag:support.appharbor.com,2010-11-23:Comment/165590212012-06-10T19:34:57Z2012-06-10T19:34:57ZInternal server Error 500 MVC 4 Web API<div><p>I've delete reference to 'System.ComponentModel.DataAnnotations
assembly, but error happaning. How I can view logs with
problem?</p></div>lubushyntag:support.appharbor.com,2010-11-23:Comment/165590212012-06-10T22:15:11Z2012-06-10T22:15:11ZInternal server Error 500 MVC 4 Web API<div><p>Usually you can set customErrors to "off" and set the element's
"errorMode" to "detailed". However that doesn't seem to work in
this case, which is likely because this errors happens in WCF. Are
the errors not being surfaced if you click the "errors" link on
your application page?</p>
<p>Another option might be to play with the
<code>existingResponse</code> attribute of the
<code><httpErrors></code> element.</p>
<p>Best,<br>
Rune</p></div>runetag:support.appharbor.com,2010-11-23:Comment/165590212012-06-11T05:01:56Z2012-06-11T05:01:56ZInternal server Error 500 MVC 4 Web API<div><p>Errors page on AppHarbor is clear. I think Web API based on ASP
.NET MVC infrastructure (without<br>
WCF). Actually we have another ability create Rest service based on
WCF (I mean WCF Web HTTP approach).</p></div>lubushyntag:support.appharbor.com,2010-11-23:Comment/165590212012-06-11T09:52:27Z2012-06-11T09:52:27ZInternal server Error 500 MVC 4 Web API<div><p>Hi there, I think <a href=
"http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.schema.databasegeneratedattribute.databasegeneratedoption%28v=vs.110%29.aspx">
System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption</a>
is from .NET 4.5 beta which is not currently installed on AppHarbor
application servers.</p>
<p>Let us know if that doesn't help you get your code working.<br>
Michael</p></div>friismtag:support.appharbor.com,2010-11-23:Comment/165590212012-06-11T10:33:19Z2012-06-11T10:33:19ZInternal server Error 500 MVC 4 Web API<div><p>Thank you. I know that. But my code not using this now
(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption).
Reference to assembly was removed.</p></div>lubushyntag:support.appharbor.com,2010-11-23:Comment/165590212012-06-11T10:46:21Z2012-06-11T10:46:21ZInternal server Error 500 MVC 4 Web API<div><p>Sorry, I had missed that. Your site seems to be up now though
(<a href=
"http://mobilevizorapi.apphb.com/">http://mobilevizorapi.apphb.com/</a>),
what's the current problem?</p></div>friismtag:support.appharbor.com,2010-11-23:Comment/165590212012-06-11T11:11:09Z2012-06-11T11:11:09ZInternal server Error 500 MVC 4 Web API<div><p>The current problem is <a href=
"http://mobilevizorapi.apphb.com/api/Platforms">http://mobilevizorapi.apphb.com/api/Platforms</a>
return Internal server error (500), without explanation</p></div>lubushyntag:support.appharbor.com,2010-11-23:Comment/165590212012-06-11T11:40:11Z2012-06-11T11:40:11ZInternal server Error 500 MVC 4 Web API<div><p>I think your app is still generating the same error. While you
may have removed the reference from you project file, you code
might still be relying on a gac'ed assembly when running locally.
Here's an article on how to get Web API to show errors to remote
clients: <a href=
"http://lostechies.com/jimmybogard/2012/04/18/custom-errors-and-error-detail-policy-in-asp-net-web-api/">
http://lostechies.com/jimmybogard/2012/04/18/custom-errors-and-erro...</a></p>
<p>Let us know if that doesn't help you get your code working.<br>
Michael</p></div>friismtag:support.appharbor.com,2010-11-23:Comment/165590212012-06-13T21:57:29Z2012-06-13T21:57:29ZInternal server Error 500 MVC 4 Web API<div><p>you can place this in your Application_Start() method inside of
global.asax.</p>
<p>GlobalConfiguration.Configuration.IncludeErrorDetailPolicy =
IncludeErrorDetailPolicy.Always;</p></div>Pavtag:support.appharbor.com,2010-11-23:Comment/165590212012-06-14T00:45:12Z2012-06-14T00:45:13ZInternal server Error 500 MVC 4 Web API<div><p>I found a solution to this problem. Though I don't know if it
will work for you. I had to roll my app back to .NET 4 from 4.5.
Doing this does not roll back the Entity framework. So just go into
nuget, uninstall Entity 5.0.0 PreRelease and reinstall 4.3.1. It
worked for me. Also the above code will show you verbose exception
to 500 errors on your server.</p></div>Pavtag:support.appharbor.com,2010-11-23:Comment/165590212012-06-14T05:04:24Z2012-06-14T05:04:24ZInternal server Error 500 MVC 4 Web API<div><p>Thanks guys. But after downgrade EF to 4.3.1 I had error.
Invalid column name 'CreatedOn'. Actually I do not have 'CreatedOn'
in my domain model.</p></div>lubushyntag:support.appharbor.com,2010-11-23:Comment/165590212012-06-14T11:41:21Z2012-06-14T11:41:21ZInternal server Error 500 MVC 4 Web API<div><p>I haven't attempted this procedure myself, but you may have to
sync your database schema with your model after downgrading, in
case the two Entity Framework versions have different conventions
for generating columns. Since this is not an AppHarbor-related
issue, you might also want to pose this question on a site like
StackOverflow: <a href=
"http://stackoverflow.com/">http://stackoverflow.com/</a></p>
<p>Michael</p></div>friismtag:support.appharbor.com,2010-11-23:Comment/165590212012-06-14T18:33:08Z2012-06-14T18:39:56ZInternal server Error 500 MVC 4 Web API<div><p>Are you using code-first database generation? if so you may have
to use migrations to make sure everything is still good with the
DB. In my case I used to database first. So when I downgraded, it
just regenerated my models from the db.</p></div>Pavtag:support.appharbor.com,2010-11-23:Comment/165590212012-06-14T18:56:57Z2012-06-14T18:56:57ZInternal server Error 500 MVC 4 Web API<div><p>Thaks for all. I am fix all issues and project work fine.</p></div>lubushyn