gpt4 book ai didi

c# - 尝试将 sessionState 存储在 Windows Azure Web 服务的 AppFabricCache 中时引发 SocketException

转载 作者:行者123 更新时间:2023-12-03 04:35:27 24 4
gpt4 key购买 nike

我正在尝试一个简单的示例项目来了解如何配置 Windows Azure 云服务以使用共置缓存。

我正在使用VS2010并关注this example但是当我读到关于协同定位缓存部分的结尾时,我无法在本地运行我的项目。

时效果很好

我遇到以下异常:(我希望它是可读的..)

Error in '/' Application.

The requested name is valid, but no data of the requested type was found

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.Net.Sockets.SocketException: The requested name is valid, but no data of the requested type was found

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:

[SocketException (0x2afc): The requested name is valid, but no data of the requested type was found] Microsoft.ApplicationServer.Caching.AsyncResultNoResult.EndInvoke() +202 Microsoft.ApplicationServer.Caching.AsyncResult`1.EndInvoke() +40 Microsoft.ApplicationServer.Caching.SocketConnectionFactory.EndConnect(IAsyncResult asyncResult) +75 Microsoft.ApplicationServer.Caching.TcpClientChannelFactory.TcpConnectionCallback(IAsyncResult result) +182

[DataCacheException: ErrorCode:SubStatus:There is a temporary failure. Please retry later. (One or more specified cache servers are unavailable, which could be caused by busy network or servers. For on-premises cache clusters, also verify the following conditions. Ensure that security permission has been granted for this client account, and check that the AppFabric Caching Service is allowed through the firewall on all cache hosts. Also the MaxBufferSize on the server must be greater than or equal to the serialized object size sent from the client.). Additional Information : The client was trying to communicate with the server: net.tcp://SessionStateDemo:24233.] Microsoft.ApplicationServer.Caching.DataCache.ThrowException(ErrStatus errStatus, Guid trackingId, Exception responseException, Byte[][] payload, EndpointID destination) +767 Microsoft.ApplicationServer.Caching.DataCache.ThrowException(ResponseBody respBody, EndpointID destination) +149 Microsoft.ApplicationServer.Caching.DataCacheFactory.EstablishConnection(IEnumerable1 servers, RequestBody request, Func3 sendMessageDelegate, DataCacheReadyRetryPolicy retryPolicy) +1313 Microsoft.ApplicationServer.Caching.<>c__DisplayClass5.b__2(RequestBody req) +198 Microsoft.ApplicationServer.Caching.SocketClientProtocol.SendReceive(IVelocityRequestPacket request, Func2 delegate, EndpointID& destination) +121
Microsoft.ApplicationServer.Caching.SocketClientProtocol.Initialize(IEnumerable
1 servers) +1225 Microsoft.ApplicationServer.Caching.DataCacheFactory.GetCache(String cacheName, CreateNewCacheDelegate cacheCreationDelegate, DataCacheInitializationViaCopyDelegate initializeDelegate) +1104 Microsoft.ApplicationServer.Caching.DataCacheFactory.GetCache(String cacheName) +131 Microsoft.Web.DistributedCache.DataCacheFactoryWrapper.CreateDataCacheFromFactory(DataCacheFactory factory, String cacheName) +63 Microsoft.Web.DistributedCache.CacheHelpers.RunCacheCreationHooks(CacheConnectingEventArgs fetchingEventArgs, IDataCacheFactory dataCacheFactory, Object sender, EventHandler1 fetchingHandler, EventHandler1 fetchedHandler) +306 Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider.CreateInternalProvider(IHttpRuntime httpRuntime, SessionInitializationData initData, IDataCacheFactory dataCacheFactory, EventHandler1 cacheFetching, EventHandler1 cacheFetched) +399 Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider.GetInternalProvider() +315 Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider.CreateNewStoreData(HttpContext context, Int32 timeout) +59 System.Web.SessionState.SessionStateModule.InitStateStoreItem(Boolean addToContext) +160 System.Web.SessionState.SessionStateModule.CompleteAcquireState() +340 System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) +1269 System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +12698078 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288

谁能告诉我这里发生了什么?我该如何解决这个问题?

该教程中是否缺少我需要做的事情?

编辑:我正在使用 VS2010 Professional 和 Windows Azure SDK 2.1。 Widnows Azure 缓存包是 v2.1.0。

相关的 web.config 部分:

<system.web>
...
<!-- Windows Azure Caching session state provider -->
<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>
...
<sytem.web>

<dataCacheClients>
<dataCacheClient name="default">
<!--To use the in-role flavor of Windows Azure Caching, set identifier to be the cache cluster role name -->
<autoDiscover isEnabled="true" identifier="SessionStateDemo" />
</dataCacheClient>
</dataCacheClients>

最佳答案

基于this thread看起来 Windows Azure 云服务必须是一个启动项目才能正常工作。否则,Windows Azure 运行时将不会初始化导致 SocketException 的原因。

关于c# - 尝试将 sessionState 存储在 Windows Azure Web 服务的 AppFabricCache 中时引发 SocketException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25973541/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com