Reputation: 3974
I have been working on building my API based on servicestack. All is working perfectly locally but when I just uploaded it to my azure web space I get the error:
AppHostBase.Instance has already been set
the full error can be seen here:
http://taxirouteapi.azurewebsites.net/
Can anyone tell me what is going wrong please?
Many thanks
Trev
Upvotes: 1
Views: 2075
Reputation: 143369
This question looks like it's a duplicate of this: https://stackoverflow.com/a/8954916/85785
You basically need to delete the AppHost that was automatically created when you installed from the ServiceStack.Host.*
NuGet packages.
Otherwise install it from the base ServiceStack NuGet package.
Upvotes: 1
Reputation: 3974
I haven't managed to fix this but when I published the project to a clean azure website on a different url it is working just fine.
All I can think of is that there was something hanging around on azure from a previous website that was stopping it working.
So, moving it to a clean azure website solved my problem.
Trev
Upvotes: 0
Reputation: 4535
Did you create your own AppHost class? If you installed ServiceStack via NuGet, many of the packages create an AppHost class for you automatically.
Look through your code and try to find where the other AppHost is and where it's being initialised.
Another thing is that if you've added it into your Application_Start in Global.asax, this might cause the error. This is because the NuGet package already includes this line:
[assembly: WebActivator.PreApplicationStartMethod(typeof(AppicationName.Web.App_Start.AppHost), "Start")]
This would mean it would get started twice.
Hope this helps.
Upvotes: 3