Is there anyone using this compoent in the production environment?

Coordinator
Mar 19, 2014 at 9:40 PM
If you have success using this component in your production environment, please reply to this thread. Thank you.
Apr 1, 2015 at 7:49 AM
I have a strong desire to use it in production but I can't get it to work. I've posted my issue in the comments section.
Coordinator
Apr 2, 2015 at 6:20 AM
martinrousev, could you tell me which OS you are using?
Apr 2, 2015 at 11:03 AM
Hi,

I tried it on my developer machine which is Windows 7 x64 with all updates installed and on a staging web server which is Server 2008 R2.
Coordinator
Apr 2, 2015 at 4:14 PM
NSession has 1 managed COM object NSession.SessionStateClient and 2 native COM objects NSession.Session and NSession.ReadOnlySession. The only reason I added a native COM object is to have deterministic finalization so that we can close the connection to the session state server when a page finishes processing.

The first step is to check is to make sure the managed client NSession.SessionStateClient is registered correctly. You can try to instantiate it directly from the asp code. You would need to use regasm in C:\Windows\Microsoft.NET\Framework64\v4.0.30319 to register NSession.dll as 64 bit COM while using the one C:\Windows\Microsoft.NET\Framework\v4.0.30319 to register it as 32 bit COM.

Also check whether your threadpool is 32 bit or 64 bit. Go to IIS Manager, select your thread pool. Click advanced settings on the right and then check "Enabled 32 bit applications" setting.
Coordinator
Apr 3, 2015 at 5:38 AM
I think I have figured out the problem. NSession.SessionStateClient.Init method, I hacked too much into the Microsoft private API. Now Microsoft has changed the API in a later asp.net version so that my code no longer works. The breaking is at the line of s_compatMode has this field is no longer there. I need to find a alternative way.
Apr 10, 2015 at 10:18 PM
Hi,

I'm looking at using this in production. If I have the ASP.NET SQL Session State installed, will this work with it. Not only do we want to share the session state, but we want to get closer to being able to put this into a web farm. Has this been tested with the SQL Session State for ASP.NET?

Thanks,
Andrea
Coordinator
Apr 10, 2015 at 11:21 PM
Andrea,

No. This only works with ASP.NET State Service. You are the first person who asked this feature. I will add it to the work item.

AndreaWil2 wrote:
Hi,

I'm looking at using this in production. If I have the ASP.NET SQL Session State installed, will this work with it. Not only do we want to share the session state, but we want to get closer to being able to put this into a web farm. Has this been tested with the SQL Session State for ASP.NET?

Thanks,
Andrea
Coordinator
Apr 10, 2015 at 11:22 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Apr 11, 2015 at 12:45 AM
Thanks,
I just found you today, and did a little dance! This looks like just what I'm looking for. I have been thinking about building something like this myself, but since you've already done it.... All I can say is YAY!

If you could add the SQL Session support that would be even better!

Thanks a million!
Andrea
Apr 11, 2015 at 11:55 AM
Hi dotneteer,

I still can't run it even though I have registered both DLL files.
Please kindly suggest.

Thanks
Ryan
Coordinator
Apr 11, 2015 at 5:06 PM
Ryan,

I can help you if you can provide more information. I would refer you to the trouble shooting steps: https://nsession.codeplex.com/wikipage?title=Trouble%20Shooting&referringTitle=Documentation

I would like you to pay especial attention to step 4 and 5. Those are the registration of managed DLL as COM (step 4) as well as security issues (step 5).

Ryan999 wrote:
Hi dotneteer,

I still can't run it even though I have registered both DLL files.
Please kindly suggest.

Thanks
Ryan
Coordinator
Apr 12, 2015 at 6:11 AM
Andrea,

I added SQL Server session state in version 0.9.1.2.

AndreaWil2 wrote:
Thanks,
I just found you today, and did a little dance! This looks like just what I'm looking for. I have been thinking about building something like this myself, but since you've already done it.... All I can say is YAY!

If you could add the SQL Session support that would be even better!

Thanks a million!
Andrea
Apr 17, 2015 at 9:25 PM
Thank you! I will try it out and let you know if I encounter any issues.

Thanks again!
Andrea
Apr 24, 2015 at 11:00 AM
Hi,

set o = Server.CreateObject("NSession.SessionStateClient") is working fine.
But set o = Server.CreateObject("NSession.Session") is not working.
I got this error

Server object error 'ASP 0177 : 800401f3'

Server.CreateObject Failed

/Test.asp, line 10

800401f3


Thank you.
Ryan
Coordinator
Apr 24, 2015 at 4:16 PM
Ryan,

Do you have VC++ 2013 runtime on the machine?
http://www.microsoft.com/en-us/download/details.aspx?id=40784



Ryan999 wrote:
Hi,

set o = Server.CreateObject("NSession.SessionStateClient") is working fine.
But set o = Server.CreateObject("NSession.Session") is not working.
I got this error

Server object error 'ASP 0177 : 800401f3'

Server.CreateObject Failed

/Test.asp, line 10

800401f3


Thank you.
Ryan
Apr 24, 2015 at 4:18 PM
I'm seeing the same problem as Ryan. The TestDiagnostic.asp runs just fine, but the test.asp page does not.

Further investigation with Dependency Walker and research has determined that windows 8.1 deprecated some dependencies, which I think is why the object will not instantiate.

I found this thread:
http://answers.microsoft.com/en-us/windows/forum/windows8_1-performance/32-bit-application-fails-to-start-after-81-upgrade/b825723e-e2a2-4c8f-bd1f-10446a5d7059

These are the missing dll's. I tried the solution that is noted as ANSWER, but dependency walker still show's that theses dll's are missing.

dotneteer, some help please?

Andrea
Coordinator
Apr 24, 2015 at 4:43 PM
Andrea,

The native dll is compiled using Visual Studio 2013 so that it needs VC++ 2012 runtime: http://www.microsoft.com/en-us/download/details.aspx?id=40784

I use Windows 8.1 myself. I have installed it on Windows Server 2008R2 and Windows Server 2012 and that is the only dependency I needed to install. Dependency walker always reveal more than you need because they discover what a DLL "knows" but not necessary "uses".

AndreaWil2 wrote:
I'm seeing the same problem as Ryan. The TestDiagnostic.asp runs just fine, but the test.asp page does not.

Further investigation with Dependency Walker and research has determined that windows 8.1 deprecated some dependencies, which I think is why the object will not instantiate.

I found this thread:
http://answers.microsoft.com/en-us/windows/forum/windows8_1-performance/32-bit-application-fails-to-start-after-81-upgrade/b825723e-e2a2-4c8f-bd1f-10446a5d7059

These are the missing dll's. I tried the solution that is noted as ANSWER, but dependency walker still show's that theses dll's are missing.

dotneteer, some help please?

Andrea
Apr 24, 2015 at 9:18 PM
Then I don't know why the object won't instantiate.

I get this on the diagnotstic page:

NSession diagnostic page

You are running 32 bit .net framework version 4.0.30319.34014.

You are using SQL Server session state. You just need to register NSession DLLs normally.

The SQL Server session state connection string is: Data Source=localhost\SQLExpress;Initial Catalog=ASPState;Integrated Security=True.

/r/n
Managed NSession.dll registered correctly.

Native NSessionNative.dll registered correctly.
But the test page I get this:
Microsoft VBScript runtime error '800a01ad'

ActiveX component can't create object

/Test.asp, line 10
I see the session information in the dB so I know it's there.

Andrea
Coordinator
Apr 24, 2015 at 10:09 PM
Andrea,

Could you try TestManaged.asp and see what it says?

Does it run without error?

If it errors out, does it error at the line that says "set o = Server.CreateObject("NSession.SessionStateClient")" or the line that says "o.GetItemExclusive()"?
Apr 24, 2015 at 10:12 PM
No error, I get this:

The value from ASP.NET is: Hello from ASP.NET. 
I saved a value to to the ASPClassicVar variable. Go back to the ASP.NET page to see the value.
when I get back to test.asp, same error.
Coordinator
Apr 24, 2015 at 10:21 PM
Andrea,

From your output, I agree that the problem is with the registration/dependency of the NSessionNative.dll. I want to see if I can reproduce it in a clean environment. You are running Windows 8.1, right? Are you running it in IIS or IIS Express?
Apr 24, 2015 at 10:22 PM
Edited Apr 24, 2015 at 10:23 PM
When I comment out the GetItemExclusive() and uncomment the GetItems(), then I get an error on line 12. I don't know if this helps you.

Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'GetItems'

/Testmanaged.asp, line 12
Apr 24, 2015 at 10:25 PM
The test is running in IISExpress on windows 8.1. I've also tested in IIS with the same result.
Coordinator
Apr 24, 2015 at 10:44 PM
OK. I will try it on a clean Windows 8.1 and see what I got this weekend. Thanks for all the information.
Coordinator
Apr 25, 2015 at 2:42 AM
There is a typo in the code. It is GetItem instead of GetItems. If you use GetItem, you should also comment out o.SetAndReleaseItemExclusive since there will be nothing to release if it is not exclusive.

AndreaWil2 wrote:
When I comment out the GetItemExclusive() and uncomment the GetItems(), then I get an error on line 12. I don't know if this helps you.

Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'GetItems'

/Testmanaged.asp, line 12
Coordinator
Apr 25, 2015 at 4:20 AM
Andrea,

I just tried on a clean Windows 8.1 machine and it worked fine. Here are the steps that I ran:

1) Creating a Windows 8.1 machine in Windows Azure: Go to Azure Control Panel, create a new virtual machine, select from Gallery, select Microsoft, and scroll down to select "Windows 8.1 Enterprise (x64)".
2) Install IIS: Log into the machine, go to Control Panel, Turn Windows features on or off, select Internet Information Services, then expand Internet Information Service, expand World Wide Web Services, expand Application Development Features, select ASP.NET 4.5 (which in-turn selected a bunch of other things) and select ASP.
3) Install 32 bit NSession: Goto http://nsession.codeplex.com/ and click download. Save and expand the zip file into c:\nsession. Then installed the 32bit Visual C++ runtime from http://www.microsoft.com/en-us/download/details.aspx?id=40784. Then from the elevated command prompt, change to c:\NSession, then run "C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm /tlb /codebase NSession.dll". Then change to C:\NSession\Release\x86 and run "C:\Windows\SysWOW64\regsvr32 NSessionNative.dll".
4) Start ASP.NET Session Service.
5) Download source code: Go to http://nsession.codeplex.com/SourceControl/latest and click Download. Unzip the zip file and copy the entire contents of NSessionTest into C:\inetpub\wwwroot.
6) Set the AppPool to 32 bit: Run Internet Information Services (IIS) Manager. Go to Application Pools, select DefaultAppPool, click Advanced Settings, then set "Enable 32-Bit Applications" to True.
7) Testing: Open internet explorer, go to http://localhost/test.aspx. Then click on the "an asp classic page" link. It worked fine.

So I don't think there is any dependency problem. Please contact me privately and I can allow you to access my virtual machine so that you can compare the configurations.

AndreaWil2 wrote:
The test is running in IISExpress on windows 8.1. I've also tested in IIS with the same result.
Apr 27, 2015 at 1:12 PM
Hi,

I have a question regarding using this in production. The application I'm trying to convert is running on a farm with three web servers. I need the state server to be defined to something different from localhost. Now I can change the stateConnectionString in the ASP.NET web config here:
<sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424"/>
... but then how do I point the ASP part of the code to the same address?

Thanks
Coordinator
Apr 27, 2015 at 2:00 PM
NSession reads the same web.config to get the connection string.

Sent from my Windows Phone

Apr 27, 2015 at 7:48 PM
I think the difference is that I'm trying to get this set up in a virtual directory. Can you try that? so the link would be //localhost/nsession. at least for the IIS version. IIS express, still no change.

Error I'm getting now in IIS is the following:
Server Error in '/NSession' Application.
--------------------------------------------------------------------------------

VirtualPath was outside the current application root.
Parameter name: virtualPath 
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.ArgumentException: VirtualPath was outside the current application root.
Parameter name: virtualPath

Source Error: 


[No relevant source lines] 

Source File: c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\nsession\f17e2d4f\45849afa\App_Web_zxbk2qev.0.cs    Line: 0 

Stack Trace: 


[ArgumentException: VirtualPath was outside the current application root.
Parameter name: virtualPath]
   Microsoft.VisualStudio.Web.PageInspector.Runtime.Tracing.VirtualPathUtilities.MakeAppRelative(String virtualPath, String appRoot) +23739
   Microsoft.VisualStudio.Web.PageInspector.Runtime.Tracing.BrowserLinkExecutionListener.FindSourceFile(PageExecutionContext context) +66
   Microsoft.VisualStudio.Web.PageInspector.Runtime.Tracing.BrowserLinkExecutionListener.OpenRenderRange(PageExecutionContext context) +30
   Microsoft.VisualStudio.Web.PageInspector.Runtime.Tracing.BrowserLinkExecutionListener.BeginContext(PageExecutionContext context) +34
   Microsoft.VisualStudio.Web.PageInspector.Runtime.WebForms.SelectionMappingRenderTraceListener.Begin(TextWriter writer, String file, Int32 start, Int32 length, Boolean literal) +181
   Microsoft.VisualStudio.Web.PageInspector.Runtime.WebForms.SelectionMappingRenderTraceListener.BeginRendering(TextWriter writer, Object renderedObject) +141
   System.Web.UI.RenderTraceListenerList.BeginRendering(TextWriter writer, Object renderedObject) +96
   Microsoft.VisualStudio.Web.PageInspector.Runtime.WebForms.TraceHelpers.BeginRenderTracing(TextWriter writer, String virtualPath, Int32 start, Int32 length, Boolean literal) +167

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +92
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +155
   System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +19
   ASP.nsessiondiagnotics_aspx.__PageInspector_BeginRenderTracing(Object[] parameters) in c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\nsession\f17e2d4f\45849afa\App_Web_zxbk2qev.0.cs:0
   ASP.nsessiondiagnotics_aspx.__Renderform1(HtmlTextWriter __w, Control parameterContainer) in c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\nsession\f17e2d4f\45849afa\App_Web_zxbk2qev.0.cs:0
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +268
   System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +102
   System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32
   System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +53
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
   System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +40
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
   System.Web.UI.Page.Render(HtmlTextWriter writer) +29
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +57
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1386
 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34248 
Apr 27, 2015 at 8:53 PM
I moved the code to the wwwroot folder, then converted NSessionTest to an application. Now the test works. Permissions error on my virtual folder, perhaps? I'll check it out... But I'm pretty sure that the folder had all the correct perms for this.
Apr 27, 2015 at 10:26 PM
Edited Apr 27, 2015 at 10:27 PM
I started with a new Vdir and named it NSessionTest2. Then I was able to get the test to work properly! YAY!!! It was all about permissions. ASP Session State server is working and the vdir.

The error above went away for a bit then came back in the same vDir... Found this:
http://stackoverflow.com/questions/19669456/virtualpath-was-outside-the-current-application-root

I disabled Browser link in VS for this Website and it instantly recovered. I'm guessing that it was added when I opened the website in VS. here is an app setting you can add to the web.config to prevent this error.

Now to turn on SQLServerState...

on test.aspx, there are no errors and the dB shows an entry saved to the dB. In test.asp I get this.

Active Server Pages error 'ASP 0241' 

CreateObject Exception 

/nsessiontest2/Test.asp 

The CreateObject of '(null)' caused exception E06D7363. 

Server object error 'ASP 0177 : e06d7363' 

Server.CreateObject Failed 

/nsessiontest2/Test.asp, line 10 

e06d7363 
Is there something else I need to do besides change the web.config for the SQLServer mode?

Andrea
Coordinator
Apr 28, 2015 at 6:03 AM
Andrea,

I was able to create a new virtual directory and configure it to work with SQL Session State. Using the "Clean" machine that I created last Friday mentioned earlier in this thread (so that NSession and NSessionNative are already installed),
  1. Go to control panel, "Turn Windows features on or off" to add .net framework 3.5. (This is the prerequisite for SQL Server 2014).
  2. Download and Install SQL Server Express 2014 x86 with Tools. This install an instance called SQLEXPRESS.
  3. From the elevated command prompt, change dir to "c:\Windows\Microsoft.NET\Framework\v4.0.30319" and run "aspnet_regsql -S NSESSIONWIN81\SQLEXPRESS -E -ssadd -sstype p". This creates a database called ASPState.
  4. Make a copy of NSessionTest source code into C:\NSession\Source\NSessionTest2.
  5. Run IIS Manager. Right-click Default Web Site and add a virtual directory called NSessionTest2 and points to C:\NSession\Source\NSessionTest2.
  6. Create a new Application Pool called NSessionTest2. Go to advanced settings and enable 32-bit applications.
  7. Right click NSessionTest2 virtual directory to convert to application. Select NSessionTest2 application pool.
  8. Add "IIS APPPOOL\NSessionTest2" as a login to SQL Server. Make it a db_owner of ASPState database.
  9. Edit the web.config in C:\NSession\Source\NSessionTest2. Change the sessionState element to <sessionState mode="SQLServer" sqlConnectionString="Data Source=NSESSIONWIN81\SQLEXPRESS;Initial Catalog=ASPState;Integrated Security=True" allowCustomSqlDatabase="true" cookieless="false" timeout="20" />
Now visit http://localhost/nsessiontest2/default.html. Run diagnostics and test. If you run into problem, try to run your NSessionDiagnotics.aspx first and see what it says.
Coordinator
Apr 28, 2015 at 6:11 AM
Could be a security problem. Check if your threadpool identity has read/execute privilege of the NSession DLLs.

AndreaWil2 wrote:
I started with a new Vdir and named it NSessionTest2. Then I was able to get the test to work properly! YAY!!! It was all about permissions. ASP Session State server is working and the vdir.

The error above went away for a bit then came back in the same vDir... Found this:
http://stackoverflow.com/questions/19669456/virtualpath-was-outside-the-current-application-root

I disabled Browser link in VS for this Website and it instantly recovered. I'm guessing that it was added when I opened the website in VS. here is an app setting you can add to the web.config to prevent this error.

Now to turn on SQLServerState...

on test.aspx, there are no errors and the dB shows an entry saved to the dB. In test.asp I get this.

Active Server Pages error 'ASP 0241' 

CreateObject Exception 

/nsessiontest2/Test.asp 

The CreateObject of '(null)' caused exception E06D7363. 

Server object error 'ASP 0177 : e06d7363' 

Server.CreateObject Failed 

/nsessiontest2/Test.asp, line 10 

e06d7363 
Is there something else I need to do besides change the web.config for the SQLServer mode?

Andrea
Coordinator
Apr 28, 2015 at 6:13 AM
Another thing to check is the bitness of the thread pool. In my steps, I only installed the 32 bit NSession. If your thread-pool is 64 bit, you need to install 64 bit NSession.
Apr 28, 2015 at 6:36 AM
dotneteer wrote:
Andrea,

I added SQL Server session state in version 0.9.1.2.

AndreaWil2 wrote:
Thanks,
I just found you today, and did a little dance! This looks like just what I'm looking for. I have been thinking about building something like this myself, but since you've already done it.... All I can say is YAY!

If you could add the SQL Session support that would be even better!

Thanks a million!
Andrea
Hi Dotneteer,

Will this option work with https://www.nuget.org/packages/Microsoft.Web.SessionState.SqlInMemory/ ?
Apr 28, 2015 at 10:36 AM
Edited Apr 28, 2015 at 3:07 PM
Awesome it all works ! ;o)
Coordinator
Apr 28, 2015 at 3:43 PM
Martin,

It does not work with https://www.nuget.org/packages/Microsoft.Web.SessionState.SqlInMemory/ today, but it is in the future road map. The reason that it does not today is that I cannot reference all those different custom providers and make NSession depending on them. Down the road, I will design an adapter interface so that NSession can load an adapter assembly which can in turn calling a custom provider.

That said, if you want to work with SQL Server in-memory today, I think it is possible use the built-in Sql Server store provider and pin those SQL tables in memory. I will try to work out the steps.

martinrousev wrote:
dotneteer wrote:
Andrea,

I added SQL Server session state in version 0.9.1.2.

AndreaWil2 wrote:
Thanks,
I just found you today, and did a little dance! This looks like just what I'm looking for. I have been thinking about building something like this myself, but since you've already done it.... All I can say is YAY!

If you could add the SQL Session support that would be even better!

Thanks a million!
Andrea
Hi Dotneteer,

Will this option work with https://www.nuget.org/packages/Microsoft.Web.SessionState.SqlInMemory/ ?
Coordinator
Apr 28, 2015 at 3:44 PM
Luke,

It seems at one point you were getting the same error as Andrea. Could you share what you have to do to resolve the error? Thanks.

LukeBaughan1 wrote:
Awesome it all works ! ;o)
Apr 28, 2015 at 3:56 PM
No problem. OK so it seems on IIS 8.5 you HAVE TO use the 64 bit versions of both the NSession.dll and x64/NSessionNative.dll - in essence this actually conflicts with the requirement to use the 32 bit versions with Visual Studio & IIS Express.

All I ended up doing to get it to run in IIS 8.5 was to unregister the 32bit DLLs and register the 64bit DLLs and ensure that the AppPool has enable 32 bit mode set to false . Ill write a batch file at some point to auto register and de-register the DLL's across the two versions.

Also I found that applying "Full Control" permission to "Everyone" in each DLL's security setting helped immensely. (You probably don't need full control but still once you've got it working you can pair back the permissions as required). This link sort of pointed me in the right direction http://blogs.msdn.com/b/robgruen/archive/2005/05/26/422328.aspx regarding IIS and how it runs COM. Hope this helps!
Coordinator
Apr 28, 2015 at 4:09 PM
Thanks for sharing the solution, Luke! BTW, you could leave both 32 bit and 64 bit registered at the same time; that is the configuration that I have on one of my test server. They do not conflict with each other.
Apr 28, 2015 at 4:16 PM
No worries, thanks for the hint ref non-conflicting DLL's. I'd probably recommend installing everything on 64bit systems and just the 32bit stuff on 32bit systems in the Docs by default - there does seem to be a weird clash between IIS Express and IIS 8.5 along with needing to give permissions on the DLL's - I don't use COM at all day to day has been a fun learning curve!
Apr 29, 2015 at 6:53 AM
Hi Dotneteer,

Yes I have it in my machine.
Mine is Windows 7 Enterprise , Service Pack 1

Thank you.
Ryan
Apr 29, 2015 at 7:07 AM
I got this output from NSessionDiagnotics.aspx.
Managed NSession.dll registered correctly.

Native NSession.dll is not registered correctly. Please run the following command to register it for the bitness of your app pool:

C:\Windows\SysWOW64\regsvr32 x86\NSessionNative.dll

Thanks,
Ryan
Apr 29, 2015 at 11:14 AM
Hey Ryan999 that means you need to open a command prompt as administrator and run that command to register the native DLL once youve run regsvr32 you should see the diagnostics output change.
Apr 30, 2015 at 3:02 AM
oh Yes!
It's working now !!!

Thank you.
Ryan
May 11, 2015 at 11:46 PM
I'm back and I swapped out the nsessionnative.dll with the new one and now it's working for me. Yay!

Thanks!
Andrea
May 18, 2015 at 8:55 PM
We are using this in a test environment with SQL server session state. Everything appears to run just fine until we sit idle on a page for more than 10 minutes. At 10 minutes I can refresh the page without an issue. At 11 minutes if I refresh the page I get the following error:


Active Server Pages error 'ASP 0241'

CreateObject Exception

/xxxxxx.asp

The CreateObject of '(null)' caused exception E06D7363.

Server object error 'ASP 0177 : e06d7363'

Server.CreateObject Failed

/xxxxxx.asp, line 3

e06d7363

This doesn't happen when I run it under iis express from visual studio on my local machine, but only on the test environment machines running IIS. Any ideas what might be happening?
May 19, 2015 at 2:16 PM
Some additional information, we are also trying to run this in a web garden, so we have multiple worker processes enabled. Under load, we also get the same error randomly just navigating pages. My assumption is that since we are under load, requests from the same session are handled by different worker processes, and when we go to a different worker process the error occurs.
Coordinator
May 30, 2015 at 4:50 PM
Edited May 30, 2015 at 8:06 PM
bistricherz, I am not sure why the error would occur using a different worker process when using SQL server session state.

I can understand that the error would occur when using ASP.NET State Service. If that happens, you can set the uri_base variable as system variable.

I will do some load testing to study this further.
Coordinator
May 30, 2015 at 9:17 PM
bstricherz,

I ran some load test using both State Service and SQL Server but did not encounter any error.

When I configured for the SQL Server test, I did get the same error message once. It was due to the SQL Server permission. ASP.NET used the application pool identity to accessed the SQL Server while asp classic used IUSR account. So I had to grant both accounts access to the SQL Server.

Check the SQL Server log file and see if you get any login error.

Also try testmanaged.asp as it usually reveal more information about the error. In test.asp, the error occurs in the constructor so that you would get the CreateObject error.
Jun 2, 2015 at 5:48 PM
Edited Jun 2, 2015 at 5:57 PM
dotneteer,

I'm getting some performance issues for some reason. When I click back and forth between Text.aspx and Test.asp, every few clicks, the site hangs. It'll finally work if I let it sit for awhile, but it takes a few minutes. I'm using the 32bit version. Any ideas?

Thanks

EDIT: I'm using Server 2012 R2
Jun 2, 2015 at 10:10 PM
dotneteer,

That was my issue! When using a trusted database connection, ASP.NET connects to the database as the app pool identity and classic asp uses the IUSR account. However if your first connection to the database is initiated by ASP.NET then classic ASP will use that "good" connection from the connection pool. If the ASP.NET connection expires from the connection pool and classic asp tries to fire up a new connection it fails because the IUSR account doesn't have access.

For example, when there is no load on the site, I can login and begin a session under ASP.NET, and I can browse classic asp pages and access the session for as long as I want without an issue, because it's using the good connection in the pool. Once I sit idle on the page for more 10-12 minutes and the connection in the pool is purged, if I refresh the page, the connection fails to the database.

Under load, with multiple worker processes, each worker process has its own connection pool. Not all those worker processes necessarily have a connection in their pool using the app pool identity, so when browsing classic asp pages the request may be handled by any of the worker processes and if that worker process doesn't have a asp.net connection in the its pool then it tries to create a new one with the IUSR identity and fails.

Anyways, I was able to re-create this behavior and verify the failed and successful connections to the database.

Thanks
Jun 2, 2015 at 11:49 PM
Not sure if this is helpful for your performance improvements, but here's an example of my CPU under load.

Under normal load testing I get this:

Image

As soon as I add this to the top of default.asp:

dim o
set o = Server.CreateObject("NSession.Session")

I get this:

Image
Coordinator
Jun 3, 2015 at 5:11 AM
jmitchelllane, I was not able to reproduce the problem Did you run against sql server or state service? I did my load testing on server 2012 r2 as well and I was able to simulate 100 users on an ultra low power server with ATOM CPU.
Jun 11, 2015 at 5:45 PM
I think the issue lies in my application. We have some pages that are called directly and also included in other pages. The only way for me to ensure that NSession is started is to include a file on every asp page that starts the session. Unfortunately, since there are some Server.Transfers used, there's no way for me to ensure that NSession is started only once and starting it multiple times causes problems (I assume since the session has to be locked). Any ideas on how I might approach this issue? Is there a way to build something into NSession so it will only start once even if it's started multiple times?
Jun 12, 2015 at 10:52 AM
dotneteer wrote:
Martin,

It does not work with https://www.nuget.org/packages/Microsoft.Web.SessionState.SqlInMemory/ today, but it is in the future road map. The reason that it does not today is that I cannot reference all those different custom providers and make NSession depending on them. Down the road, I will design an adapter interface so that NSession can load an adapter assembly which can in turn calling a custom provider.

That said, if you want to work with SQL Server in-memory today, I think it is possible use the built-in Sql Server store provider and pin those SQL tables in memory. I will try to work out the steps.

martinrousev wrote:
dotneteer wrote:
Andrea,

I added SQL Server session state in version 0.9.1.2.

AndreaWil2 wrote:
Thanks,
I just found you today, and did a little dance! This looks like just what I'm looking for. I have been thinking about building something like this myself, but since you've already done it.... All I can say is YAY!

If you could add the SQL Session support that would be even better!

Thanks a million!
Andrea
Hi Dotneteer,

Will this option work with https://www.nuget.org/packages/Microsoft.Web.SessionState.SqlInMemory/ ?
Hi dotneteer,

Is there any development in this regard?
Jul 1, 2015 at 8:11 AM
Turned out just pinning the existing tables from the SQL Server session state provider to memory is no easy task. The tables have binary type in them, they have constraints and indexes. It is complex to alter everything to make it work as in-memory tables but even then the changes made impose a limit on the session size.
Coordinator
Jul 6, 2015 at 5:58 AM
martinrousev wrote:
Turned out just pinning the existing tables from the SQL Server session state provider to memory is no easy task. The tables have binary type in them, they have constraints and indexes. It is complex to alter everything to make it work as in-memory tables but even then the changes made impose a limit on the session size.
Martin, you are right about the limitations of in-memory tables and we cannot pin the tables of the existing SQL Server session state provider. However, after installing the database in SQL Server 2014 In-Memory OLTP Provider - ASP.NET (https://msftdbprodsamples.codeplex.com/releases/view/125282?WT.mc_id=Blog_SQL_Announce_DI), I think it is possible to write a set of stored procedures compatible with stored procedures used by the built-in SQL server session state.
Oct 8, 2015 at 5:37 AM
Hi,

I am using Visual Studio 2013 with .Net framework 4.5 in Windows 8.1 Operating System.

I have followed below steps, and its working fine perfectly with asp.net / asp web forms. But now my requirement is integrate classic asp and MVC 4.0 / 5.0 (Razor syntax) together, its not working. Whenever i try to read values from session of MVC, or session of asp to MVC is not throwing any error but return null.

Can u please help us on how to share session with MVC 4.0/5.0.?

1) Creating a Windows 8.1 machine in Windows Azure: Go to Azure Control Panel, create a new virtual machine, select from Gallery, select Microsoft, and scroll down to select "Windows 8.1 Enterprise (x64)".
2) Install IIS: Log into the machine, go to Control Panel, Turn Windows features on or off, select Internet Information Services, then expand Internet Information Service, expand World Wide Web Services, expand Application Development Features, select ASP.NET 4.5 (which in-turn selected a bunch of other things) and select ASP.
3) Install 32 bit NSession: Goto http://nsession.codeplex.com/ and click download. Save and expand the zip file into c:\nsession. Then installed the 32bit Visual C++ runtime from http://www.microsoft.com/en-us/download/details.aspx?id=40784. Then from the elevated command prompt, change to c:\NSession, then run "C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm /tlb /codebase NSession.dll". Then change to C:\NSession\Release\x86 and run "C:\Windows\SysWOW64\regsvr32 NSessionNative.dll".
4) Start ASP.NET Session Service.
5) Download source code: Go to http://nsession.codeplex.com/SourceControl/latest and click Download. Unzip the zip file and copy the entire contents of NSessionTest into C:\inetpub\wwwroot.
6) Set the AppPool to 32 bit: Run Internet Information Services (IIS) Manager. Go to Application Pools, select DefaultAppPool, click Advanced Settings, then set "Enable 32-Bit Applications" to True.
7) Testing: Open internet explorer, go to http://localhost/test.aspx. Then click on the "an asp classic page" link. It worked fine.
Coordinator
Oct 11, 2015 at 6:13 AM
dilipextentian,

Sorry for the late apply. I tried and it worked just find with MVC5 just fine. I added the MVC5 to the NSessionTest project. Please get the latest source code to try it out. I removed the default route so that you have to use http://localhost:????/Home to reach the home controller.
Jun 20, 2016 at 8:49 PM
Just want to say thank you!
I needed to store user sessions in state service to prevent data loss between IIS pool restarts and it works fine for me in production env.

Thanks!