Web Pages issue with azure when servicestack is deployed

251 Views Asked by At

I am trying to deploy Servicestack application to azure website. Application is with asp.net host and razor view engine.

Here is final deployed version. And also github project

Now, it working fine in local without any issue. But giving problem after deployment. If I forcefully load the assembly in web.config azure can't load it. And if don't do that servicestack crashed nullpointer exception.

I checked the application setting, as per it azure sites are running webpages version 3.x.x.x.

Please let me know if any further information needed.

Here is stack trace of error

[NullReferenceException: Object reference not set to an instance of an object.]
   ServiceStack.HttpHandlerFactory..cctor() +336

[TypeInitializationException: The type initializer for 'ServiceStack.HttpHandlerFactory' threw an exception.]
   ServiceStack.HttpHandlerFactory..ctor() +0

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +113
   System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +232
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +83
   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1136
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +128
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +18
   System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +60
   System.Web.Configuration.HandlerFactoryCache..ctor(String type) +46
   System.Web.HttpApplication.GetFactory(String type) +86
   System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +262
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

[UPDATE] I guess issue is not on servicestack side. Things are working fine if I deploy the C# version of it. To make compile on azure there is need to add below code in fsproj file.

<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" 
        Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets" 
        Condition="true" />
1

There are 1 best solutions below

0
On

I manage to solve the issue. I have put details on my blog.

Basically due to some weird reason I couldn't access to global.asax file. So, I moved start up code of servicestack with signalR and things started working.