ASP.NET——"/"应用程序中的服务器错误

中文错误:

 

无法向会话状态服务器发出会话状态请求。请确保 ASP.NET State Service (ASP.NET 状态服务)已启动,并且客户端端口与服务器端口相同。如果服务器位于远程计算机上,请检查 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection 的值,确保服务器接受远程请求。如果服务器位于本地计算机上,并且上面提到的注册表值不存在或者设置为 0,则状态服务器连接字符串必须使用“localhost”或“127.0.0.1”作为服务器名称。  
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。  

异常详细信息: System.Web.HttpException: 无法向会话状态服务器发出会话状态请求。请确保 ASP.NET State Service (ASP.NET 状态服务)已启动,并且客户端端口与服务器端口相同。如果服务器位于远程计算机上,请检查 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection 的值,确保服务器接受远程请求。如果服务器位于本地计算机上,并且上面提到的注册表值不存在或者设置为 0,则状态服务器连接字符串必须使用“localhost”或“127.0.0.1”作为服务器名称。

源错误:  

执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。   

堆栈跟踪:  


[HttpException (0x80072749): 无法向会话状态服务器发出会话状态请求。请确保 ASP.NET State Service (ASP.NET 状态服务)已启动,并且客户端端口与服务器端口相同。如果服务器位于远程计算机上,请检查 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection 的值,确保服务器接受远程请求。如果服务器位于本地计算机上,并且上面提到的注册表值不存在或者设置为 0,则状态服务器连接字符串必须使用“localhost”或“127.0.0.1”作为服务器名称。]

 

 

 

 

 

英文错误:

 

Server Error  in   ' / '  Application.
--------------------------------------------------------------------------------

Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service 
is  started and that the client and server ports are the same.  If the server  is  on a remote machine, please ensure that it accepts remote requests by checking the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection.  If the server  is  on the local machine, and  if  the before mentioned registry value does not exist or  is   set  to  0 , then the state server connection  string  must use either  ' localhost '  or  ' 127.0.0.1 '   as  the server name. 
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.Web.HttpException: Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service 
is  started and that the client and server ports are the same.  If the server  is  on a remote machine, please ensure that it accepts remote requests by checking the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection.  If the server  is  on the local machine, and  if  the before mentioned registry value does not exist or  is   set  to  0 , then the state server connection  string  must use either  ' localhost '  or  ' 127.0.0.1 '   as  the server name.

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: 


[HttpException (
0x8007274d ): Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service  is  started and that the client and server ports are the same.  If the server  is  on a remote machine, please ensure that it accepts remote requests by checking the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection.  If the server  is  on the local machine, and  if  the before mentioned registry value does not exist or  is   set  to  0 , then the state server connection  string  must use either  ' localhost '  or  ' 127.0.0.1 '   as  the server name.]
   System.Web.SessionState.OutOfProcSessionStateStore.MakeRequest(StateProtocolVerb verb, String id, StateProtocolExclusive exclusiveAccess, Int32 extraFlags, Int32 timeout, Int32 lockCookie, Byte[] buf, Int32 cb, Int32 networkTimeout, SessionNDMakeRequestResults
&  results)  + 1565
   System.Web.SessionState.OutOfProcSessionStateStore.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem) 
+ 192
   System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs) 
+ 355
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 
+ 92
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean
&  completedSynchronously)  + 64

 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:
2.0 . 50727.42 ; ASP.NET Version: 2.0 . 50727.42  

 

 

 

解决方法:

 

 

1、我的电脑-》服务-》启动 asp.net State (asp.net 状态服务)

或者 

2、Web.config設定:

以下是範例的設定給您參考,關於State Server的Port,預設值是 42424,如果您想要修改的話,請您找到以下的機碼值:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\Port 直接修改成您要的數字,並且在對應的Web.config中修改掉。

<configuration>
  <system.web>
    <sessionState mode="StateServer"
      stateConnectionString="tcpip=SampleStateServer:42424"
      cookieless="false"
      timeout="20"/>
  </system.web>
</configuration>

3、删掉web.config 中上面的配置串。这样 session 就绑定在iis 进程中。而不是状态服务

 

 

 

转载于:https://www.cnblogs.com/adaasafod/archive/2010/07/21/1782420.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
解决ASP.NET应用程序服务器错误的方法可以分为以下几步: 1. 查看错误消息:当出现服务器错误时,ASP.NET会自动记录错误信息。通过查看错误消息,可以了解具体的错误原因和位置。可以在Web.config文件设置<customErrors>来控制错误信息的显示,或者通过调试工具来获取更详细的错误信息。 2. 调试:使用调试工具,例如Visual Studio,可以逐步调试代码,并查找可能的错误。可以通过设置断点、跟踪变量和查看调用堆栈等方法来定位和修复错误。 3. 日志记录:将关键的操作和错误信息记录到日志文件。可以使用ASP.NET提供的日志记录功能,或者通过自定义代码来实现。通过查看日志文件,可以帮助我们追踪和分析错误。 4. 异常处理:通过在代码使用异常处理机制,可以捕捉和处理潜在的错误。可以使用try-catch语句块来捕获异常,并在catch块处理异常情况。可以将异常信息记录到日志文件,或者向用户显示友好的错误信息。 5. 配置文件:检查web.config文件的设置,确保应用程序的配置正确。例如,检查数据库连接字符串、认证和授权设置等。 6. 更新和修复:确保应用程序和相关组件的版本是最新的。ASP.NET团队会定期发布更新和修复补丁,可以通过升级来解决一些已知的问题。 7. 缓存问题:有时候服务器错误可能是由于缓存引起的。可以尝试清除缓存,并重新加载页面或者相关数据。 8. 确保服务器环境配置正确:确保服务器上的ASP.NET环境配置正确,例如.NET Framework版本、应用程序池设置等。 9. 参考文档和社区:ASP.NET有一个庞大的社区,可以在官方文档、博客、论坛等地方找到大量的解决方案和经验分享。可以在社区提问,寻求帮助。 10. 专家咨询:如果以上方法都无法解决问题,可以寻求专家的帮助。可以通过技术论坛、咨询服务或者微软的支持渠道来获取帮助。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值