got a problem with my asp.net mvc project timing out after only a couple of minutes. It's especially annoying because I've got quite a complex upload and import procedure which falls over when i 开发者_如何学运维get logged out. I currently use asp.net membership provider for authentication.
I've tried a few things that I've seen on this site and others but to no avail. Here is what I have so far in the web config:
<location path="Admin/Upload">
<system.web>
<httpRuntime executionTimeout="1200"/>
</system.web>
</location>
<system.web>
<sessionState mode="InProc" timeout="20" cookieless="false" />
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="20" />
</authentication>
<add name="ConnectionString" providerName="System.Data.SqlClient" connectionString="Server=SERVERNAME;Database=DBNAME;User Id=USER;Password=PASSWORD;timeout=30;MultipleActiveResultSets=True" />
I was sure it was only a minute before being timed out before I added the sessionstate timeout, then it was upped to 2 mins, but can't be 100%.
I thought about using this:
<lifetime leaseTime="15M"/>
...but not 100% sure how to implement it - anyone had any success with it, or know something else I could try?
Thanks
EDIT: I'm on a cloud hosting solution, but only have a control panel - no access to IIS
UPDATE: I've now tried adding lifetime leasetime and it's not made any difference:
<system.runtime.remoting>
<application>
<lifetime leaseTime="20M" />
</application>
</system.runtime.remoting>
</configuration>
UPDATE 2: Ok, I've edited the title and the web config values to reflect my latest effort, but I'm still struggling. I spoke to the hosting company who set the connection timeout to 20 minutes. However, it the session ends after 10 mins. Is there anything else I can try?
I'm getting there, but I would like 20 minutes!
The lifetime leasetime tag goes in the application tag.
<application>
<lifetime leasetime = "15M"/>
I've never actually used it but if it is like other timeouts idk if you will need the M at the end. That is pure speculation though. You should also be able to set it to "0" so that its lifetime is "forever"
As for the session timeout that looks like it should be set for 100 minutes. However, it should be inside of your <configuration>
tags
EDIT Completely unrelated to the question kind of. But i like how your runtime execution timeout is "over 9000"
Right, I got a solution to this, but it wasn't what I was expecting.
It turned out I was using the aspnet Membership Provider wrongly. I was using like a previous membership system I worked on and logging in then setting the UserId as a session variable and using that throughout the site. I then discovered that is the incorrect way to use it, and changed it to a combination of User.Identity.IsAuthenticated
and Membership.GetUser().ProviderUserKey
.
It no longer times out and all is well. Thanks anyway.
精彩评论