我正在尝试将Servicestack应用程序部署到azure网站。应用程序是使用asp.net主机和razor视图引擎。
Here是最终部署的版本。还有github project
现在,它在本地工作正常,没有任何问题。但在部署后给出问题。如果我强行在web.config中加载程序集,azure就无法加载它。如果不做那个servicestack崩溃了nullpointer异常。
我检查了应用程序设置,因为azure网站正在运行网页版本3.x.x.x.
如果需要进一步的信息,请告诉我。
这是错误的堆栈跟踪
[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
[更新] 我猜问题不在Servicestack方面。如果我部署它的C#版本,一切正常。 要在azure上进行编译,需要在fsproj文件中添加以下代码。
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets"
Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets"
Condition="true" />
答案 0 :(得分:1)
我设法解决了这个问题。我已将详细信息放在my blog上。
基本上由于一些奇怪的原因,我无法访问global.asax文件。所以,我用signalR启动了servicestack的代码,事情就开始了。