带有 TableStorageSessionStateProvider 的 DataServiceRequestException

发布于 2024-10-17 18:07:03 字数 4061 浏览 6 评论 0 原文

我正在尝试使用 Azure 培训套件中的 TableStorageSessionStateProvider。我可以毫无问题地使用该示例,但是当我在网络应用程序中使用它时,出现此异常:

System.Data.Services.Client.DataServiceRequestException occurred
  Message=An error occurred while processing this request.
  Source=Microsoft.WindowsAzure.StorageClient
  StackTrace:
       at Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.get_Result()
       at Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.ExecuteAndWait()
       at Microsoft.Samples.ServiceHosting.AspProviders.TableStorageSessionStateProvider.<>c__DisplayClass5.<ResetItemTimeout>b__4()
  InnerException: System.Data.Services.Client.DataServiceClientException
       Message=<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
  <code>UpdateConditionNotSatisfied</code>
  <message xml:lang="en-US">The update condition specified in the request was not satisfied.
RequestId:c552d552-ba1c-4920-84fc-e716705b58b9
Time:2011-02-17T12:43:38.5650557Z</message>
</error>
       Source=System.Data.Services.Client
       StatusCode=412
       StackTrace:
            at System.Data.Services.Client.DataServiceContext.SaveResult.<HandleBatchResponse>d__1e.MoveNext()
       InnerException: 

我尝试过 this,但到目前为止还没有运气。我还看到发生空引用异常,所以我猜 TableStorageSessionStateProvider 的行为并不像InProc 之一,所以也许我必须检查应用程序中如何使用会话。但是,可能有什么问题呢?

编辑:嗯,我发现如果您仅使用具有相同异常的 TableStorageSessionStateProvider,Azure 培训工具包中的示例也会失败。您只需评论其他提供商即可:

<authentication mode="Forms">
  <forms loginUrl="~/Account/Login.aspx" timeout="2880" />
</authentication>

<!-- Membership Provider Configuration -->
<!--<membership defaultProvider="TableStorageMembershipProvider" userIsOnlineTimeWindow="20">
  <providers>
    <clear />
    <add name="TableStorageMembershipProvider" type="Microsoft.Samples.ServiceHosting.AspProviders.TableStorageMembershipProvider" description="Membership provider using table storage" applicationName="AzureStore" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" requiresUniqueEmail="true" passwordFormat="Hashed" />
  </providers>
</membership>

<profile>
  <providers>
    <clear />
    <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
  </providers>
</profile>

--><!-- RoleManager Provider Configuration --><!--
<roleManager enabled="true" defaultProvider="TableStorageRoleProvider" cacheRolesInCookie="true" cookieName=".ASPXROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All">
  <providers>
    <clear />
    <add name="TableStorageRoleProvider" type="Microsoft.Samples.ServiceHosting.AspProviders.TableStorageRoleProvider" description="Role provider using table storage" applicationName="AzureStore" />
  </providers>
</roleManager>-->

<!-- SessionState Provider Configuration -->
<sessionState mode="Custom" customProvider="TableStorageSessionStateProvider">
  <providers>
    <clear />
    <add name="TableStorageSessionStateProvider" type="Microsoft.Samples.ServiceHosting.AspProviders.TableStorageSessionStateProvider" applicationName="AzureStore" />
  </providers>
</sessionState>
    <machineKey decryption="AES" decryptionKey="F7FA540B4DFD82E5BB196B95D15FF81F5B973B5514F973D2A46B4C52224A3ABC" validation="SHA1" validationKey="5B973B5514F973D2A46B4C52224A3ABC90378EFA9DE62168764FF0DCE537184F0535D5D9AD66DEDC5B973B5514F973D2A46B4C52224A3ABC90378EFA97DC1ABF" />

I'm trying to use the TableStorageSessionStateProvider from the Azure training kit. I can use the example without problems but when I use it in my web app, I get this exception:

System.Data.Services.Client.DataServiceRequestException occurred
  Message=An error occurred while processing this request.
  Source=Microsoft.WindowsAzure.StorageClient
  StackTrace:
       at Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.get_Result()
       at Microsoft.WindowsAzure.StorageClient.Tasks.Task`1.ExecuteAndWait()
       at Microsoft.Samples.ServiceHosting.AspProviders.TableStorageSessionStateProvider.<>c__DisplayClass5.<ResetItemTimeout>b__4()
  InnerException: System.Data.Services.Client.DataServiceClientException
       Message=<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
  <code>UpdateConditionNotSatisfied</code>
  <message xml:lang="en-US">The update condition specified in the request was not satisfied.
RequestId:c552d552-ba1c-4920-84fc-e716705b58b9
Time:2011-02-17T12:43:38.5650557Z</message>
</error>
       Source=System.Data.Services.Client
       StatusCode=412
       StackTrace:
            at System.Data.Services.Client.DataServiceContext.SaveResult.<HandleBatchResponse>d__1e.MoveNext()
       InnerException: 

I've tried this, but no luck so far.I've also seen null reference exceptions happening, so I guess that the TableStorageSessionStateProvider it's not behaving like the InProc one, so maybe I have to check how sessions are being used in the application. But, what could be the problem ?

EDIT: Well, I've find out that the example in the Azure training kit also fails if you only use the TableStorageSessionStateProvider with the same exception. You just have to comment the other providers:

<authentication mode="Forms">
  <forms loginUrl="~/Account/Login.aspx" timeout="2880" />
</authentication>

<!-- Membership Provider Configuration -->
<!--<membership defaultProvider="TableStorageMembershipProvider" userIsOnlineTimeWindow="20">
  <providers>
    <clear />
    <add name="TableStorageMembershipProvider" type="Microsoft.Samples.ServiceHosting.AspProviders.TableStorageMembershipProvider" description="Membership provider using table storage" applicationName="AzureStore" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" requiresUniqueEmail="true" passwordFormat="Hashed" />
  </providers>
</membership>

<profile>
  <providers>
    <clear />
    <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
  </providers>
</profile>

--><!-- RoleManager Provider Configuration --><!--
<roleManager enabled="true" defaultProvider="TableStorageRoleProvider" cacheRolesInCookie="true" cookieName=".ASPXROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All">
  <providers>
    <clear />
    <add name="TableStorageRoleProvider" type="Microsoft.Samples.ServiceHosting.AspProviders.TableStorageRoleProvider" description="Role provider using table storage" applicationName="AzureStore" />
  </providers>
</roleManager>-->

<!-- SessionState Provider Configuration -->
<sessionState mode="Custom" customProvider="TableStorageSessionStateProvider">
  <providers>
    <clear />
    <add name="TableStorageSessionStateProvider" type="Microsoft.Samples.ServiceHosting.AspProviders.TableStorageSessionStateProvider" applicationName="AzureStore" />
  </providers>
</sessionState>
    <machineKey decryption="AES" decryptionKey="F7FA540B4DFD82E5BB196B95D15FF81F5B973B5514F973D2A46B4C52224A3ABC" validation="SHA1" validationKey="5B973B5514F973D2A46B4C52224A3ABC90378EFA9DE62168764FF0DCE537184F0535D5D9AD66DEDC5B973B5514F973D2A46B4C52224A3ABC90378EFA97DC1ABF" />

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

楠木可依 2024-10-24 18:07:03

如果您想知道为什么 TableStorageSessionProvider 出现此错误,请参阅我对 这个问题。如果您想了解如何在 Azure 中使用 SQL 会话提供程序,请参阅 的答案这个问题

如果您今天需要使用某些东西,您唯一真正的选择是使用 SQL 会话提供程序,即使它不受支持。一旦 AppFabric 缓存退出 CTP,它将成为必经之路。

If you want to know why you're getting this error with the TableStorageSessionProvider see my answer to this question. If you want to know about the using the SQL session provider in Azure see the answer to this question.

If you need to use something today, you're only real choice is to use the SQL session provider even though it's not supported. Once AppFabric Caching is out of CTP it will be the way to go.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文