Azure托管缓存服务的会话状态提供程序不会保留会话对象

时间:2014-12-08 22:13:13

标签: asp.net session caching azure

我尝试使用会话状态提供程序将Azure托管缓存服务实现到我的解决方案中。目前我正在设置一个Session变量,只是在回发后检索它并且它是null。我可以使用DataCache对象将对象成功保存到缓存中,这告诉我在Web.config中正确配置了我的数据缓存设置,尽管我的会话状态配置设置可能需要微调。

相关的Web.config:

<sessionState mode="Custom" customProvider="AFCacheSessionStateProvider">
  <providers>
    <add name="AFCacheSessionStateProvider" type="Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, Microsoft.Web.DistributedCache" cacheName="default" dataCacheClientName="default" applicationName="AFCacheSessionState" />
  </providers>
</sessionState>
<dataCacheClients>
  <dataCacheClient name="default">
   <autoDiscover isEnabled="true" identifier="myEndpoint" />
   <securityProperties mode="Message" sslEnabled="true">
    <messageSecurity authorizationInfo="myKey" />
  </securityProperties>
</dataCacheClient>

更新:我通过软件包管理器控制台(而不是通过GUI)重新安装了Microsoft.WindowsAzure.Caching,这产生了很多我通过GUI安装看不到的异常。

 PM> Install-Package Microsoft.WindowsAzure.Caching -Version 2.3.1
Installing 'Microsoft.WindowsAzure.Caching 2.3.1.0'.

You are downloading Microsoft.WindowsAzure.Caching from Microsoft, the license agreement to which is available at http://go.microsoft.com/fwlink/?LinkId=306250. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.

Successfully installed 'Microsoft.WindowsAzure.Caching 2.3.1.0'.
Adding 'Microsoft.WindowsAzure.Caching 2.3.1.0' to GPS-MVC.
Successfully added 'Microsoft.WindowsAzure.Caching 2.3.1.0' to GPS-MVC.

Exception calling "Item" with "1" argument(s): "InvalidParameter
Parameter name: index"
At C:\Users\eric.s\Source\Workspaces\packages\Microsoft.WindowsAzure.Caching.2.3.1.0\tools\install.ps1:244 char:96
+ $csdefFiles = $ccProject.ProjectItems | where { $_.Properties -ne $null -and $_.Properties.Item <<<< ('BuildAction') -ne $null -and $_.Properties.Item('BuildAction').Value -eq 'ServiceDefinition' }
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

Exception calling "Item" with "1" argument(s): "InvalidParameter
Parameter name: index"
At C:\Users\eric.s\Source\Workspaces\packages\Microsoft.WindowsAzure.Caching.2.3.1.0\tools\install.ps1:244 char:96
+ $csdefFiles = $ccProject.ProjectItems | where { $_.Properties -ne $null -and $_.Properties.Item <<<< ('BuildAction') -ne $null -and $_.Properties.Item('BuildAction').Value -eq 'ServiceDefinition' }
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

Exception calling "Item" with "1" argument(s): "InvalidParameter
Parameter name: index"
At C:\Users\eric.s\Source\Workspaces\packages\Microsoft.WindowsAzure.Caching.2.3.1.0\tools\install.ps1:343 char:96
+ $cscfgFiles = $ccProject.ProjectItems | where { $_.Properties -ne $null -and $_.Properties.Item <<<< ('BuildAction') -ne $null -and $_.Properties.Item('BuildAction').Value -eq 'ServiceConfiguration'
 }
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

Exception calling "Item" with "1" argument(s): "InvalidParameter
Parameter name: index"
At C:\Users\eric.s\Source\Workspaces\packages\Microsoft.WindowsAzure.Caching.2.3.1.0\tools\install.ps1:343 char:96
+ $cscfgFiles = $ccProject.ProjectItems | where { $_.Properties -ne $null -and $_.Properties.Item <<<< ('BuildAction') -ne $null -and $_.Properties.Item('BuildAction').Value -eq 'ServiceConfiguration'
 }
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

New-Object : Exception calling ".ctor" with "2" argument(s): "Access to the path 'C:\Users\eric.s\Source\Workspaces\GPS-MVC.Azure\ServiceDefinition.csdef' is denie
d."
At C:\Users\eric.s\Source\Workspaces\packages\Microsoft.WindowsAzure.Caching.2.3.1.0\tools\install.ps1:90 char:27
+         $fileWriter = New-Object <<<<  System.Xml.XmlTextWriter($filepath, $null)
    + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInvocationException
    + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand

Property 'Formatting' cannot be found on this object; make sure it exists and is settable.
At C:\Users\eric.s\Source\Workspaces\packages\Microsoft.WindowsAzure.Caching.2.3.1.0\tools\install.ps1:91 char:15
+         $fileWriter. <<<< Formatting = [System.Xml.Formatting]::Indented
    + CategoryInfo          : InvalidOperation: (Formatting:String) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

Property 'Indentation' cannot be found on this object; make sure it exists and is settable.
At C:\Users\eric.s\Source\Workspaces\packages\Microsoft.WindowsAzure.Caching.2.3.1.0\tools\install.ps1:92 char:15
+         $fileWriter. <<<< Indentation = 4
    + CategoryInfo          : InvalidOperation: (Indentation:String) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

Property 'IndentChar' cannot be found on this object; make sure it exists and is settable.
At C:\Users\eric.s\Source\Workspaces\packages\Microsoft.WindowsAzure.Caching.2.3.1.0\tools\install.ps1:93 char:15
+         $fileWriter. <<<< IndentChar = ' '
    + CategoryInfo          : InvalidOperation: (IndentChar:String) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

You cannot call a method on a null-valued expression.
At C:\Users\eric.s\Source\Workspaces\packages\Microsoft.WindowsAzure.Caching.2.3.1.0\tools\install.ps1:94 char:20
+         $fileWriter.Flush <<<< () 
    + CategoryInfo          : InvalidOperation: (Flush:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Multiple ambiguous overloads found for "Save" and the argument count: "1".
At C:\Users\eric.s\Source\Workspaces\packages\Microsoft.WindowsAzure.Caching.2.3.1.0\tools\install.ps1:403 char:15
+ $csdefXml.Save <<<< ($csdefWriter)
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

You cannot call a method on a null-valued expression.
At C:\Users\eric.s\Source\Workspaces\packages\Microsoft.WindowsAzure.Caching.2.3.1.0\tools\install.ps1:404 char:19
+ $csdefWriter.Close <<<< ()
    + CategoryInfo          : InvalidOperation: (Close:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

New-Object : Exception calling ".ctor" with "2" argument(s): "Access to the path 'C:\Users\eric.s\Source\Workspaces\GPS-MVC.Azure\ServiceConfiguration.Cloud.cscfg'
 is denied."
At C:\Users\eric.s\Source\Workspaces\packages\Microsoft.WindowsAzure.Caching.2.3.1.0\tools\install.ps1:90 char:27
+         $fileWriter = New-Object <<<<  System.Xml.XmlTextWriter($filepath, $null)
    + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInvocationException
    + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand

Property 'Formatting' cannot be found on this object; make sure it exists and is settable.
At C:\Users\eric.s\Source\Workspaces\packages\Microsoft.WindowsAzure.Caching.2.3.1.0\tools\install.ps1:91 char:15
+         $fileWriter. <<<< Formatting = [System.Xml.Formatting]::Indented
    + CategoryInfo          : InvalidOperation: (Formatting:String) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

Property 'Indentation' cannot be found on this object; make sure it exists and is settable.
At C:\Users\eric.s\Source\Workspaces\packages\Microsoft.WindowsAzure.Caching.2.3.1.0\tools\install.ps1:92 char:15
+         $fileWriter. <<<< Indentation = 4
    + CategoryInfo          : InvalidOperation: (Indentation:String) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

Property 'IndentChar' cannot be found on this object; make sure it exists and is settable.
At C:\Users\eric.s\Source\Workspaces\packages\Microsoft.WindowsAzure.Caching.2.3.1.0\tools\install.ps1:93 char:15
+         $fileWriter. <<<< IndentChar = ' '
    + CategoryInfo          : InvalidOperation: (IndentChar:String) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

You cannot call a method on a null-valued expression.
At C:\Users\eric.s\Source\Workspaces\packages\Microsoft.WindowsAzure.Caching.2.3.1.0\tools\install.ps1:94 char:20
+         $fileWriter.Flush <<<< () 
    + CategoryInfo          : InvalidOperation: (Flush:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Multiple ambiguous overloads found for "Save" and the argument count: "1".
At C:\Users\eric.s\Source\Workspaces\packages\Microsoft.WindowsAzure.Caching.2.3.1.0\tools\install.ps1:409 char:16
+     $cscfgXml.Save <<<< ($cscfgWriter)
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

You cannot call a method on a null-valued expression.
At C:\Users\eric.s\Source\Workspaces\packages\Microsoft.WindowsAzure.Caching.2.3.1.0\tools\install.ps1:410 char:20
+     $cscfgWriter.Close <<<< ()
    + CategoryInfo          : InvalidOperation: (Close:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

New-Object : Exception calling ".ctor" with "2" argument(s): "Access to the path 'C:\Users\eric.s\Source\Workspaces\GPS-MVC.Azure\ServiceConfiguration.Local.cscfg'
 is denied."
At C:\Users\eric.s\Source\Workspaces\packages\Microsoft.WindowsAzure.Caching.2.3.1.0\tools\install.ps1:90 char:27
+         $fileWriter = New-Object <<<<  System.Xml.XmlTextWriter($filepath, $null)
    + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInvocationException
    + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand

Property 'Formatting' cannot be found on this object; make sure it exists and is settable.
At C:\Users\eric.s\Source\Workspaces\packages\Microsoft.WindowsAzure.Caching.2.3.1.0\tools\install.ps1:91 char:15
+         $fileWriter. <<<< Formatting = [System.Xml.Formatting]::Indented
    + CategoryInfo          : InvalidOperation: (Formatting:String) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

Property 'Indentation' cannot be found on this object; make sure it exists and is settable.
At C:\Users\eric.s\Source\Workspaces\packages\Microsoft.WindowsAzure.Caching.2.3.1.0\tools\install.ps1:92 char:15
+         $fileWriter. <<<< Indentation = 4
    + CategoryInfo          : InvalidOperation: (Indentation:String) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

Property 'IndentChar' cannot be found on this object; make sure it exists and is settable.
At C:\Users\eric.s\Source\Workspaces\packages\Microsoft.WindowsAzure.Caching.2.3.1.0\tools\install.ps1:93 char:15
+         $fileWriter. <<<< IndentChar = ' '
    + CategoryInfo          : InvalidOperation: (IndentChar:String) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

You cannot call a method on a null-valued expression.
At C:\Users\eric.s\Source\Workspaces\packages\Microsoft.WindowsAzure.Caching.2.3.1.0\tools\install.ps1:94 char:20
+         $fileWriter.Flush <<<< () 
    + CategoryInfo          : InvalidOperation: (Flush:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Multiple ambiguous overloads found for "Save" and the argument count: "1".
At C:\Users\eric.s\Source\Workspaces\packages\Microsoft.WindowsAzure.Caching.2.3.1.0\tools\install.ps1:409 char:16
+     $cscfgXml.Save <<<< ($cscfgWriter)
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest

You cannot call a method on a null-valued expression.
At C:\Users\eric.s\Source\Workspaces\packages\Microsoft.WindowsAzure.Caching.2.3.1.0\tools\install.ps1:410 char:20
+     $cscfgWriter.Close <<<< ()
    + CategoryInfo          : InvalidOperation: (Close:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

虽然它声明该软件包已成功安装,但这个巨大的异常列表让我停下来。我的安装出了什么问题,我该如何解决?

谢谢!

0 个答案:

没有答案
相关问题