1

I am returning around 20ish thumbnails on a page. Problem is that the last few (always around 5~) load very slowly.

No difference whether I am loading them like

using(FileStream ltFS = new FileStream(Server.MapPath("~/Themes/Content/Images/nocover.png"), FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite))

or

return File(Server.MapPath("~/Themes/Content/Images/nocover.png"), "image/png");

I google and found this on SO

[SessionState(System.Web.SessionState.SessionStateBehavior.Disabled)]

If I am trying that, I get the error

The SessionStateTempDataProvider class requires session state to be enabled.

enter image description here

  • Do these requests target a separate server machine over a network or you make localhost requests to your own machine? – Wiktor Zychla Sep 11 '16 at 10:54
  • They are 14kb in size and on the same machine. – Marianne Markwardt Sep 11 '16 at 10:55
  • I know that this is probably misconfiguration, but I don't know where to look and what to look out for. This is in Visual Studio IIS Express, not even in live mode. Same problem on fresh IIS 7.5 installation. – Marianne Markwardt Sep 11 '16 at 11:04
  • Just tried it the same way the example you provided does it. public FileStreamResult Cover(Guid pInternalBookId) { return new FileStreamResult(new FileStream(Server.MapPath("~/Themes/Content/Images/nocover.png"), FileMode.Open, FileAccess.ReadWrite), "image/png"); } – Marianne Markwardt Sep 11 '16 at 11:17
  • In most IIS app pool configurations the default number of threads that can run simultaneously is 5. But you need to return 20 files almost at same time. Try increasing the number of worker processes for your application pool. Open IIS as admin, select your web site on "Connections" panel (on your left), click "advanced settings" and find out what's the application pool for that site. Close, and go back to connections again. Find your app pool, go to advanced settings (right click) and under Process Model find "Maximum Worker processes". Increase this number. – derloopkat Sep 11 '16 at 13:23

1 Answers1

0

Every request in an ASP.Net web application gets a Session lock at the beginning of a request, and then releases it at the end of the request!.Until that time any other request from the user will wait. If you are using the TempData or Session in MVC methods then there will be asp.net session lock will process the requests one by one.This attribute [SessionState(System.Web.SessionState.SessionStateBehavior.Disabled)] is just to avoid asp.net session lock and the error means that you are using the TempData somewhere in your methods If you are not updating the Session in then try using [SessionState(System.Web.SessionState.SessionStateBehavior.ReadOnly)] instead

Krishjs
  • 358
  • 2
  • 17