473,657 Members | 2,486 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VirtualPathProv ider and Application Restart

Hi

We are trying to build an application where we render some of the .aspx
pages from the database using a class derived from
System.Web.Host ing.VirtualPath Provider. Users configure the contents of the
page at runtime via the web interface and we do a XSLT transformation and
store the contents of the .aspx pages in the database. The .aspx pages are
hooked to a well known code behind in an assembly that is deployed as a
assembly in the bin folder of the web site.using the @Page inherits
attribute. None of the contents are wired up using the autoeventwireup =
true but the code behind is a generic class that is written in such a way
that it has the intelligence to subscribe to events etc.

This approach is pretty similar to what is given here:

http://kbalertz.com/910441/virtual-p...ual-paths.aspx.

The PROBLEM! Asp.NET worker process restart. This depends on the entry in
the web.config file "numRecompilesB eforeAppRestart ".

We want to avoid the asp.net worker process to restart itself as other
users of the application would loose the session state (which is In-Proc at
the moment) when the asp.net worker process unloads the application domain.

We use .NET framework 2.0 and VS2005 to do all this along with SQL Server
2005.

A couple of things that I already know may hack this up (dont want to do)

1. I can increase the numRecompilesBe foreAppRestart -- but this is
probably not a good idea since this would not make the problem go away.
Users would still experience this problem whenever asp.net does restart
itself.
2. I can make the session stored in the state server and write a back end
job to remove the session; or write a HttpModule to somehow remove the
session from the database -- this is a big performance hit as sessions
stored in the database would make things slower
3. I could as an alternative, dynamically load controls on the page.,
instead of doing things the way we do now. However, this would again
degrade performance and also increase complexity.
What we dont know

1. Is this approach conceptually flawed or is this ok? If so what are we
missing out? (The GetFileHash() override implementation of the
VirtualPathProv ider that we have right now returns a new hash code each time
the contents of the database for the .aspx changes. We return a null for the
GetCacheDepende ncy since we cant have a dependency to detect if the file
content of the .aspx has changed)
2. Is there a possibility of using the ClientBuildMana ger to precompile a
..aspx file when we generate the .aspx file -- maybe if the .aspx is already
precompiled, when the user requests for a page, the appdomain will NOT
unload itself? We do know that asp.net does a compilation when the user
requests for a page. What if we do the compilation using the
ClientBuildMana ger. And the user requests for the page AFTER the
application does the compilation?

Please let us know what you think if you can as we have tried to post here
to no avail and am not sure what I am missing anymore! I do have your phone
number but decided that it would be impolite to give you a call before
sending you an email.

http://forums.asp.net/p/1301629/2540774.aspx#2540774
http://www.opinionatedgeek.com/Blog/...BlogEntry.aspx

Many thanks in advance. Anticipating your reply anxiously... I hope I am
clear as to what I wanted to convey...

Kris
Aug 11 '08 #1
1 4609
I had sent an email to Walter Wang of Microsoft Online Community Support who
wrote this in reply to what I had asked. Thanks once again Walter., as now
atleast I can move forward. Since I have no other choice, I decided to move
the session state to the Database Server and move a lot of lightweight
things to a cookie. Also, I guess I will write a HttpModule to detect when
the user logs out etc to remove the record for the Session Id from the
Database.

Hi Sriram,
I'm afraid there's no way to workaround this automatic restarting. You see,
once an assembly has been loaded into the default AppDomain, there's no way
to unload it from the AppDomain. When you update an ASPX file, a new
assembly (maybe batch compiled with other changed ASPX files) will get
generated and loaded into the AppDomain. That means some obsolete copies of
assemblies are loaded in the AppDomain and wasting memory. The ASP.NET
engine has to restart the AppDomain once the numRecompilesBe foreAppRestart
limit is reached. Note the VirtualPathProv ider is using the same compiling
engine, therefore this limitation also applies.
Best regards,

Walter Wang

Microsoft Online Community Support

"Sriram Srivatsan" <sr************ *@srasys.co.inw rote in message
news:uf******** ********@TK2MSF TNGP03.phx.gbl. ..
Hi

We are trying to build an application where we render some of the .aspx
pages from the database using a class derived from
System.Web.Host ing.VirtualPath Provider. Users configure the contents of
the page at runtime via the web interface and we do a XSLT transformation
and store the contents of the .aspx pages in the database. The .aspx
pages are hooked to a well known code behind in an assembly that is
deployed as a assembly in the bin folder of the web site.using the @Page
inherits attribute. None of the contents are wired up using the
autoeventwireup = true but the code behind is a generic class that is
written in such a way that it has the intelligence to subscribe to events
etc.

This approach is pretty similar to what is given here:

http://kbalertz.com/910441/virtual-p...ual-paths.aspx.

The PROBLEM! Asp.NET worker process restart. This depends on the entry
in the web.config file "numRecompilesB eforeAppRestart ".

We want to avoid the asp.net worker process to restart itself as other
users of the application would loose the session state (which is In-Proc
at the moment) when the asp.net worker process unloads the application
domain.

We use .NET framework 2.0 and VS2005 to do all this along with SQL Server
2005.

A couple of things that I already know may hack this up (dont want to do)

1. I can increase the numRecompilesBe foreAppRestart -- but this is
probably not a good idea since this would not make the problem go away.
Users would still experience this problem whenever asp.net does restart
itself.
2. I can make the session stored in the state server and write a back
end job to remove the session; or write a HttpModule to somehow remove the
session from the database -- this is a big performance hit as sessions
stored in the database would make things slower
3. I could as an alternative, dynamically load controls on the page.,
instead of doing things the way we do now. However, this would again
degrade performance and also increase complexity.
What we dont know

1. Is this approach conceptually flawed or is this ok? If so what are we
missing out? (The GetFileHash() override implementation of the
VirtualPathProv ider that we have right now returns a new hash code each
time the contents of the database for the .aspx changes. We return a null
for the GetCacheDepende ncy since we cant have a dependency to detect if
the file content of the .aspx has changed)
2. Is there a possibility of using the ClientBuildMana ger to precompile a
.aspx file when we generate the .aspx file -- maybe if the .aspx is
already precompiled, when the user requests for a page, the appdomain will
NOT unload itself? We do know that asp.net does a compilation when the
user requests for a page. What if we do the compilation using the
ClientBuildMana ger. And the user requests for the page AFTER the
application does the compilation?

Please let us know what you think if you can as we have tried to post here
to no avail and am not sure what I am missing anymore! I do have your
phone number but decided that it would be impolite to give you a call
before sending you an email.

http://forums.asp.net/p/1301629/2540774.aspx#2540774
http://www.opinionatedgeek.com/Blog/...BlogEntry.aspx

Many thanks in advance. Anticipating your reply anxiously... I hope I
am clear as to what I wanted to convey...

Kris

Aug 11 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3363
by: Pint | last post by:
I would like to know if there is a programatic way to force the Application object to restart. I have a hosted website where I will be unable to control the webserver (eg:iisreset), and I would like to be able to trap certain events and cause the entire application to reload. Thanks in advance. -Pint
0
1548
by: Kenny | last post by:
Help...wimper.. been trying to get a virtualpathprovider to work and I have to be missing something. I want users to be able to enter something like mydomain.com/userentereddirectory/ and have that serve up a file. So I use vpp to code up an initialization even, virturalfile, virtualdirectory and virtualpath provider. I have a simple file for testing testing.aspx (no codebehind) that just sets a label to 'hello world' on pageload. Now...
0
1365
by: Pavel Kocar | last post by:
Hi all, how to detect existing .ascx control in Net 2.0? I try to use method in VirtualPathProvider: HostingEnvironment.VirtualPathProvider.FileExists("~/App_UserControls/ucDataPager.ascx"); it return true if file ucDataPager.ascx control exists, but if I publish web site (no editable) and .ascx files not available on the disc, this method return false, its bug?
1
1674
by: VV | last post by:
I've created virtualpathprovider class in my application. Everything is ok in developer enviroment (asp.net dev server), but when I switch to IIS everything crashes with Server 500 and 404 error. Please, what I'm missing?! VV
0
1230
by: forge1968 | last post by:
I want to handle URLs like this on my IIS site: http://localhost/myapp/REST/foo/1 ('REST/foo/1' doesn't exist - I'll dynamically create the content). I have implemented my own VirtualPathProvider and VirtualFile classes to do this. However, the mimetype of the response is 'application/ octet-stream'. I want it to be 'text/xml'. Changing HttpContext.Current.Response.ContentType does not affect the
0
1262
by: Shane | last post by:
Hello, I'm using VirtualPathProvider for a CMS-like system. As soon as I register the VPP I can no longer debug code with a normal Build -- any changes that I've made since the first build are not recognized unless I rebuild all. Could somebody explain why this is happening? I presume it has something to do with the page being compiled and put into a cache but I cannot figure out how to change the behavior. I can find nothing that...
5
2853
by: Charles Zhang | last post by:
I am creating dynamic web pages according to the user inputs from a web page. For instance, a user typed in a text, I would want the text being the source code of the dynamic page. My question is: How could I access session variables from class that derives from VirtualPathProvider or VirtualFile or the control values of previous web page?
1
2633
by: Brian Simmons | last post by:
Hi All, I know that if you modify the web.config file or any file in the App_Code subfolder, that ASP.net 2.0 will "restart" the application (i.e. clear out any sessions, etc...). Are there any other changes that restart the application? Will modify a code-behind .cs/.vb which calls a class in the App_Code folder restart the application?
5
2630
by: IUnknown | last post by:
Ok, we are all aware of the situation where modifying the folder structure (adding files, folders, deleting files, etc) will result in ASP.NET triggering a recompilation/restart of the application. In a nutshell, I understand how this can be considered desireable by some, but I am not one of those people. My situation is that we have a root site (hosted @ http://www.mydomain.com) in the root application folder '/'.
0
8305
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8726
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8603
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7320
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1944
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.