Domanda

I'm a beginner in ASP.NET 2.0.Probably this could sound too basic and stupid issue for someone expert in the ASP.NET.But this is giving me sleepless nights.

Basically i have developed a simple multilingual website with a master page and content pages which fills inside the content place holder portions of the master page. The application works great when it is configured to run on the ASP.NET Development Server 2.0. But once i publish it to run on the IIS web server it will no longer function. :( I could see from the trace that none of the session variables i use are stored and redirected to the relevant content pages.

Although the contents are displayed, the session variable values by which i take some decisions on the redirected pages are lost and i run into exceptions.

Please guide me where am i going wrong and exact procedure for Publishing an application.

Ex: my home page has URL which runs something like http://localhost/Onlineupdate/Home.aspx?vers=1.1&lang=fr-FR

Based on the above URL, i strip and save the vers and the lang variables in a Session variable. However these are lost when hosted on IIS.

È stato utile?

Soluzione

There are a dozen or so things that could cause the session data to be lost:

  • IIS restarting
  • The app pool restarting
    • due to a change to the web.config
    • due to a change to anything in the \bin directory
    • memory limit reached, or a bug causing the app pool to reset.
    • several other possible causes
  • Your host is actually a web farm, and you're using in-process memory, which will cause issues when one server fails over to the other, unless you're using SQL Server session state mode.

Since we don't have enough information to answer exactly what's happening in your specific situation, I'd ask you to start by reading up, starting here: http://msdn.microsoft.com/en-us/library/ms178581.aspx

Edit: I did find this blog article, which may be helpful: http://blogs.msdn.com/b/amenon/archive/2007/08/21/troubleshooting-session-loss.aspx


The following is not necessarily part of the answer, but added to try to be helpful.

If it's feasible, from my own personal experience, we've had success in eliminating our lost session issues by using the SqlServer Session State mode. Since we implemented this, our session issues have all but disappeared.

Altri suggerimenti

also i found the main problem that you should initialize session before use like:

session[“id”]=””;

and after that it well work fine

In order to prevent this to happen first in the web.config set restartOnExternalChanges to false. Now in web.config changes must be propagated manually(this means that the dev is now responsible to build a mechanism for config change propagation).

Hint: You can use file watcher for this that will listen for the web.config (or any config you use in you web. app) for changes and wrap it as a watchable configuration so you can reload the configs when they are changed.

Hope this helps

I faced the same issue in my ASP.NET MVC website . and i have resolve it by next steps :

  1. open IIS Manager
  2. go to the application pools
  3. right click on the application pool which related to your website
  4. click on "Advanced Settings"
  5. set "Idle Time-out (minutes)" to be "20"
  6. set "Maximum Worker Processes" to be "1"
  7. Click Ok to close the window

these steps has resolved my issue.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top