Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
275 views
in Technique[技术] by (71.8m points)

asp.net - Opening website from IIS in Visual Studio restarts the website

I have a website in IIS and if I open it in Visual Studio (running as admin) the application pool always restarts - which is a big problem on my live server. Can anyone help me prevent it from happening?

I realise precompiled web applications exist and that RDPing to live server and using VS like that is not ideal but I can't change that right now.

My project is a VB website (no MVC - just .aspx pages) and I use Roslyn and all the new language features so I can't remove DotNetCompilerPlatform (I don't think choice of language or the code has anything to do with the problem). This happens on Windows 10 and Server 2016.

From my investigation I found the following:

VS causes dir change notification

It seems VS does SetSecurityFile on every file in /roslyn directory which triggers a NotifyChangeDirectory message. The permissions on the files remain the same - VS updates them for no apparent reason and that rightfully causes a recompile of the website.

I've cleaned out the NuGet package DotNetCompilerPlatform. I've tried applying loose permissions on the project directory (Everyone - Full Control). I've tried VS 2017, 2019 and the new 2019 preview. Nothing helped so far. What I do know is that this didn't used to happen in the past.

Any ideas would be appreciated.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The application pool will not automatically restart unless you set the recycling time or an error occurs, So please check if there are related errors in your Event Viewer. and try to change the startMode of your application pool to AlwaysRunning:

  1. Open Internet Information Services (IIS) Manager.
  2. In the Connections pane, select the Application Pools node, revealing the Application Pools pane in the main view.
  3. Click Advanced Settings…
  4. Locate the Start Mode option under the General group and set it to AlwaysRunning.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...