我最近在新服务器上部署Azure应用程序时遇到了一个奇怪的错误。我正在使用ASP提供商(由微软提供的Azure SDK代码示例)。不管几次上传,我都得到了这个大而丑陋的消息。请帮助!
Error in '/' Application. --------------------------------------------------------------------------------
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace: [NullReferenceException: Object reference not set to an instance of an object.]
Microsoft.Samples.ServiceHosting.AspProviders.<>c__DisplayClass5.<ResetItemTimeout>b__4() in C:Usersupload.userDesktopDeploymentsDeployment 2.20_AAspProvidersTableStorageSessionStateProvider.cs:497
Microsoft.Samples.ServiceHosting.AspProviders.ProviderRetryPolicies.RetryNImpl(Action action, Int32 numberOfRetries, TimeSpan minBackoff, TimeSpan maxBackoff, TimeSpan deltaBackoff) in C:Usersupload.userDesktopDeploymentsDeployment 2.20_AAspProvidersSecUtil.cs:439
Microsoft.Samples.ServiceHosting.AspProviders.<>c__DisplayClass1.<RetryN>b__0(Action action) in C:Usersupload.userDesktopDeploymentsDeployment 2.20_AAspProvidersSecUtil.cs:395
System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) +739 System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +114 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +370
-------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
是AppFabric Cache正式发布并得到microsoft的支持。这个链接对教程有很大帮助:http://msdn.microsoft.com/en-us/gg457897然而,使用这种方法有一个额外的计费方面,而Tablestoragesessionprovider使用BlobStorage,这是微不足道的。
这些示例的优点是提供了代码,因此您通常可以更仔细地查看出了什么问题。我已经看了一下,你得到这个错误的最有可能的原因是有一个错误的会话状态提供程序的配置(它可能指向错误的帐户)或表和容器不存在于该帐户。
有可能没有可用的会话对象,但我认为这不太可能。
话虽如此,表存储会话提供程序不适合在生产环境中发布。你最好使用SQL Server会话提供程序或App Fabric缓存会话提供程序。