This question is about App domains and Sessions. Is it possible to have IIS run each User Session in a seperate App Domain. If Yes, Could you please let me settings in the config file that affect this.
Regards,
Anil.
This is not possible under Windows 2000 or Windows 2003 running ASP.NET 1.x or ASP.NET 2.0 (even with .NET Framework 3.5 installed). The same applies to ASP.NET running on IIS7.
A possible workaround (which certainly wouldn't scale) would be to create a windows service to manage the starting and stopping of new processes and communicate with that service from the web application using WCF.
I don't know of a way in which this could be easily done. Please explain your problem further as to why an AppDomain is necessary - it may be easier to just move Application collection use to Session.
Update: The correct solution to your problem is, unfortunately, to re-architect the library for a server-based session solution. What you could do, and I strongly do not recommend this, is create an AppDomain per Session, storing a reference to it in Session, and then relying on calls such as CreateInstanceAndUnwrap, magic strings, and reflection (with no real compile time checking) to load an instance of the library per user. I imagine that if you pursue this solution you will spend much more time in total debugging it and dealing with errors than you would if you did a re-architecture time investment upfront.
Related
Exception on IIS Server When try to create .wav file on c# using SpeechSynthesizer.
This error is caused when the application is unable to access a voice for the SpeechSynthesizer to use. The first possible cause is the lack of any installed voices on the system. Odds are this isn't the problem, but you should still double check by running something like the following bit of code:
SpeechSynthesizer ssTest = new SpeechSynthesizer();
System.Diagnostics.Debug.WriteLine(ssTest.GetInstalledVoices().Count);
Assuming the above returns a number higher than 0, the problem is likely a more complicated issue with your application's security settings.
Several methods in the SpeechSynthesizer class, including SetOutputToWaveFile, require the immediate caller to be fully trusted. This might not be a huge concern for a desktop application (which the SpeechSynthesizer class was likely designed for) but has more serious security repercussions in a web environment. Therefore, IIS's default settings only make applications partially trusted. There are a number of ways to change this, possibly the quickest and certainly the dirtiest way is switching the application pool's identity from the default to an account with administrator privileges like the LocalSystem account.
Once again, just for emphasis, this will seriously harm the security of your application and should be fully researched before implementing.
Simple fix: Grant read/write access to C:\windows\system32\config\systemprofile\appdata\roaming for the same user that the app pool is running under.
Simply, run the app as "administrator". ;)
We have a legacy system which is build in classic ASP. As we move to asp.net, we find ourselves creating web applications as we migrate old stuff to .net and add new functionalities to the system. I would say maybe 30% of them would share the same library, loading the same dlls. (all applications share the same app pool)
My question would be, what's the pros and cons of this approach?
Would it be better to have one application root?
I am not really looking for a specific answer, just curious what you people do usually and why?
thanks a lot
I would place things that can be logically grouped together into its own app pool.
Example: Components needed for a website or webapp under IIS could be considered a single logical group, therefore it needs its own app pool.
Anything else that is separate should have its own domain with own app pool.
But, IMHO, i think it's a judgment call based on the nature of the app and if it has any dependencies... etc. You know the system better than anybody, so from a 20k foot view of it all, how should things be logically separted?
Example scenario:
If you have an app that needs to be reset via IIS, will it affect others (will others go down due to the one app that requires an IIS reset)? If it's not a big deal, then why not (lump it together with the other). If it is a big deal, then keep it separate so it's not dependent on any externals.
What is the limit of IIS 6.0? like for example if i need to host 100,000 or 200,000 websites on IIS 6.0, how many machines would i need? or is IIS7 would be a better choice in this case for some reason?
As mentioned in the comments above the scale isn't so much the number of websites you create in IIS, but how complex and how busy those sites are.
In IIS6 one website does not necessarily equate to one executing process on the server. Application pools can group multiple websites into a single executing process to group and/or isolate applications. Alternately a single app pool can spawn multiple executing processes to make better use of server hardware.
It might help if you were to provide more detail in your question about what exactly you're trying to accomplish. If you're going to be serving hundreds of thousands of sites it would probably be a good idea to partner with a hosting company, or get some assistance from someone who knows the ins and outs of IIS, or another platform in detail and has operational experience with working through large-scale hosting scenarios.
IIS7 is not radically different from IIS6 in any performance-related way; with one exception: you can run ASP.NET in a "native" pipeline mode that bypasses some processing steps. I prefer IIS7 (if I can choose) because of its manageability advantages. But like everyone else said here: the question is impossible to answer without more information.
Hosting that many websites with IIS will be cost-prohibitive in licensing fees. Most large scale web hosting is done on Linux using Apache.
I have two ASP.NET 2.0 applications in IIS; a public booking system and an admin system to manage prices. There is a shared DLL project that accesses the database, used by both applications.
To improve performance, the prices are cached in DLL code to save hitting the database on every request. However, when the administrator changes the prices, the cache is refreshed on the admin application (and obviously it isn't refreshed on the public application)
So, to the question. Is it possible to configure IIS so that these two applications share the HttpRuntime.Cache? If so, how should it be set up?
That would beat the point of having two applications - they should not share the same DLL memory heap, that would be needed. What you need is a communications channel between the two and have the admin web-pages notify about changes to the cache - which would cause a refresh.
May be something simple, but maybe a simple page you post to that causes the cache to check for updates? Or - have the application check for updates now and again based on a time stamp.
(Another option is to create a service where the cache resides, but I think that is outside the scope of a simple solution)
No; by experience this will not work (.NET 4.6, IIS 8.5, 2 applications a common DLL using the same application pool). Documentation is very hard to come by (beyond "cache items are stored in memory") - in fact the only descriptive part was what #Thies stated above - but as he stated I believe this is because the cache is stored in the DLL's allocated memory, therefore (since we still have one process but two app domains) the common DLL is loaded separately into two application domains and the DLL's memory is not shared.
Has anyone been able to get an NHibernate-based project up and running on a shared web host?
NHibernate does a whole lot of fancy stuff with reflection behind the scenes but the host that I'm using at the moment only allows applications to run in medium trust, which limits what you can do with reflection, and it's throwing up all sorts of security permission errors. This is the case even though I'm only using public properties in my mapping files, though I do have some classes defined as proxies.
Which companies offer decent (and reasonably priced) web hosting that allows NHibernate to run without complaining?
Update: It seems from these answers (and my experimentation -- sorry Ayende, but I still can't get it to work on my web host even after going through the article you linked to) is to choose your hosting provider wisely and shop around. It seems that WebHost4Life are pretty good in this respect. However, has anyone tried NHibernate with Windows shared hosting with 1and1? I have a Linux account with them already and I'm fairly satisfied on that front, and if I could get NHibernate to work seamlessly with Windows I'd probably stick with them.
I have had no issues with running NHibernate based apps on WebHost4Life, although I don't like them.
Getting NHibernate to run on medium trust is possible. A full description on how this can be done is found here:
http://blechie.com/WPierce/archive/2008/02/17/Lazy-Loading-with-nHibernate-Under-Medium-Trust.aspx
I ran my my own geek siteoff N2 (which uses NHibernate and Windsor Castle) and 4 pet NHibernate/Fluent projects on dailyrazor.com for a while.
You get a good deal for $5 a month, including unlimited SQL Server databases and subdomains and it runs off Plesk with FTP and remote SQL Server Management Studio access.
I'm using a Finnish host called Nebula that happily runs my NHibernate-leveraging applications. I had an issue once with trust levels; the machine.config on the host was configured to deny reflection but I successfully overrode it in the web.config.