When will the IIS restart the website? - asp.net

I got some information form restart website in IIS when changing values in the appSettings of the web.config so now I know IIS will restart the application poll not website.
As I know when I update the web.config the IIS would restart the application pool but sometimes I didn't update the web.config but after my deploy the website seems like be restarted. Why? because I update the website.dll or some other reason and how does IIS works to know the dll was updated and it should use the new dll to serve the user?

Create/Update/Delete files under below folders will cause IIS recycle the app pool:
Bin
App_GlobalResources
Global.asax
App_Code
App_WebReferences
Web.config
Some resources:
https://blogs.msdn.microsoft.com/tmarq/2007/11/01/asp-net-file-change-notifications-exactly-which-files-and-directories-are-monitored/
https://webmasters.stackexchange.com/questions/77322/update-net-website-without-reloading
https://shazwazza.com/post/all-about-aspnet-file-change-notification-fcn/
ASP.net C# requires IIS restart when new DLL copied to BIN directory

Related

can the web.config file be removed while the application is running?

If the web.config file is removed while the asp.net application is running, will it still continue or will it not allow config file to delete?
By default .NET monitors a few of the standard files/directories such as ~/web.config and ~/App_Code/. Once a change has been made, the application pool is reset. When the application pool starts back up, if there is no web.config file, the application will immediately crash.

Web deploy deleting SMTP configs from IIS

When deploying my asp.net website to IIS using Web deploy, my previously configured SMTP settings (in my IIS application) are erased. I know I can set this settings in web.config but i don't want to.

How to config IIS so that it uses web.config of each folder

I am working on a DotNetNuke module and I need to put some settings in its web.config. So far I was using IIS Express for my development environment and everything was working fine.(The module has a web.config in its folder and it can read its settings from there while it's hosted on IIS Express)
Now I am testing my module on a DNN that is hosted on IIS and the module can't find it's settings ( It seems that IIS doesn't look at web.config files in other folders rather that its main web.config)
The question is how should I configure IIS so that my module can access its web.config in its folder ?
Yes, in IIS you'll have to convert your folder to an application (right-click on that folder), that will create a new AppDomain root and be using a different global.asax, bin folder and web.config.

Global.asax Application_BeginRequest not firing unless physical file exists - 404

I use URL rewriting (HttpContext.Current.RewritePath(...)) inside Global.asax so the physical files mostly don't exist.
Everything was working fine until I had to remove site from IIS (8.5) and add it again.
And now I get 404 not found for every request. Example http://localhost/site/article123
And Global.asax Application_BeginRequest event not even firing.
If I however will add empty default.aspx file in folder /site/article123 everything starts to work fine with URL being correctly rewritten.
Files have not changed, so it's ought to be the problem with IIS configuration.
I do have following inside web.config:
<modules runAllManagedModulesForAllRequests="true">
Project in IIS is set as an Application with Application Pool .NET v2.0 Classic
Edit:
Same story in IIS 8.0
The problem was in Managed Pipeline Mode set as classic. Switching from classic to integrated by changing Application pool from .NET v2.0 Classic to .NET v2.0 sorted the problem.
As I understood this: in classic mode IIS is managing requests, while in intergated mode incoming IIS requests map to the ASP.NET engine.
More on pipeline modes: What is the difference between 'classic' and 'integrated' pipeline mode in IIS7?
You need to have ReWrite Module installed under IIS 8.5
Use Web Installer Platform to install it.

Could not load file or assembly App_Web_xxxxxxxx or one of its dependencies

The full error is:
Could not load file or assembly 'App_Web_xxxxxxxx, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
Where xxxxxxxx is the ASP.Net generated temp name.
We are getting this error for a WCF service hosted within an ASP.Net application.
The weird thing is that it happens very occasionally, independent of deployment changes... and when it does happen the service "breaks" for all subsequent requests.
At the moment, the workaround for us at the moment is to delete the temporary assemblies from the application's folder in:
%windir%\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files
The app is hosted in IIS7 on a win 2008 server, using .Net 3.5
Any ideas most appreciated!
This may be the issue with ASP.NET compiler when having .SVC within ASP.NET application. You can avoid the issue by turning off the batch compilation i.e. add following in Web.Config under <system.web> element,
<compilation batch="false">
Please find the steps to repro the issue,
a. Create a ASP.NET website application and add WCF Service (in this example EPOCS002.svc)
b. Set the “repro-website” directory as the root of a new site (I set it up on IIS 7.5 in classic
pipeline, 32-bit worker process, .NET 2.0 SP2/3.5SP1, with anonymous authentication enabled).
c. Recycle the application pool for the site.
d. Browse default.aspx
e. Browse EPOCS002.svc
f. Edit default.aspx in some way (add a space somewhere) and save it.
g. Browse again to default.aspx
h. Recycle the application pool for the site.
I. Browse again to default.aspx
J. Browse again to EPOCS002.svc
P.S. Microsoft is investigating the cause of the issue at this moment and I'll update the post when I've some information.
HTH,
Amit

Resources