2013-10-16 100 views
10

我正在嘗試使用狀態服務器會話。無法向會話狀態服務器發出會話狀態請求?

我已經改變了我的會話狀態下面:

<sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424" cookieless="false" timeout="20" /> 

從本地主機上運行自己的網站,一切工作正常。

但是,當我發表我的網站,並嘗試在網上,我收到以下錯誤運行:

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.

該網站託管在Afrihost服務器,resarching我發現,這可能是因爲ASP.NET錯誤後國家服務尚未開始。有沒有一種方法可以檢查Afrihost服務器是否正在運行這項服務或者遠程啓動它?

另外我知道IP地址127.0.0.1是爲本地主機,但因爲你在網絡服務器上發佈你的應用程序,它變成本地的那臺機器是正確的。

+0

您可以在服務器上建立RDP連接嗎?如果是這樣,請確保該服務已正確啓動(在services.msc中),並且如果啓動不正確,請檢查Windows事件日誌 – CharlesAD

+0

@CharlesAD我不認爲Afrihost允許RDP連接到那裏服務器,因爲它們承載的是大多數南非的網站。 – Pomster

回答

23

該錯誤消息表示ASP.NET狀態服務未運行。

您的連接字符串應始終爲stateConnectionString="tcpip=127.0.0.1:42424"由於託管站點將成爲本地計算機的任何位置。

聯繫Afrihost並要求他們重新啓動服務後,所有事情都開始順利運行。

enter image description here

+2

是的,這是正確的答案。請按照上面的建議。 :) – 2013-10-18 02:26:07

+0

此外請確保將啓動類型設置爲自動,所以您不需要每次重新啓動服務器時都更改它。 – Pomster

+0

我有同樣的錯誤,並cannoit啓動服務如何可以解決 –