weixin_39975529
weixin_39975529
2021-01-01 10:06

Issues shutting down site in IIS. An attempt was made to access an exiting process

Taking the site down to do a publish causes the site's .exe process to stay hanging in a blocked state. Trying to kill the process with processhacker shows the error 'An attempt was made to access an exiting process'.

This error is discussed in the trouble shooting section of the asp.net core website, how to publish to IIS. But none of 2 reasons shown there are valid for my project

 
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<startup>()
.Build();
host.Run();
</startup>

该提问来源于开源项目:aspnet/IISIntegration

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

19条回答

  • weixin_39975529 weixin_39975529 4月前

    Ok, the issues still persist with 1.1.

    I took a few screenshots the publish error in visual studio, and the task manager and event viewer on the server.

    FYI: the same happens if i try to take the site offline through IIS manager instead of automatic through a publish.

    screenshot_1 Publish fails after creating the App_Offline.html

    screenshot_2 Site should be offline, but processes still there in taskmanager. Impossible to kill.

    screenshot_3 screenshot_4 Restarting the site fails because the file is locked.

    点赞 评论 复制链接分享
  • weixin_39975529 weixin_39975529 4月前

    Not sure if it's related, but:

    In the above screenshots you'll see multiple instances of the file Paulo.Web.exe. But in the description of the process, one still has the .exe while the other hasn't. It's always the process without the .exe in the description that keeps handing.

    点赞 评论 复制链接分享
  • weixin_40006265 weixin_40006265 4月前

    What version of ANCM are you using?

    点赞 评论 复制链接分享
  • weixin_39975529 weixin_39975529 4月前

    Each time i've upgraded the project to the latest asp.net core, we've also updates the server with the latest available host bundle. So this should be 1.1 as well. Don't know if there's a console command of which the output can confirm we're on the latest version?

    点赞 评论 复制链接分享
  • weixin_40006265 weixin_40006265 4月前

    Try this

    
    [System.Diagnostics.FileVersionInfo]::GetVersionInfo("C:\WINDOWS\System32\inetsrv\aspnetcore.dll").FileVersion
    
    点赞 评论 复制链接分享
  • weixin_39964819 weixin_39964819 4月前

    FileVersion = 7.1.1970.0 (same as Product version)

    点赞 评论 复制链接分享
  • weixin_39934302 weixin_39934302 4月前

    ANCM sends a ctr-break signal to gracefully shutdown user's process. in this case, the process is in exiting state but never fully terminated per the error message "'An attempt was made to access an exiting process'". This looks wired. Could you please share a repro so that we can debug it in-house?

    点赞 评论 复制链接分享
  • weixin_39975529 weixin_39975529 4月前

    -wang : Any way to contact you / send the repo without posting it here?

    On a sidenote: publishing from visual studio failed even before attempting to write the files due to an account issue of the wep deploy user. Having fixed this we now get the more logical 'publish failed do to file in use error'. In the event viewer of the server, i also found the following log:

    A process serving application pool 'MyAppPool' terminated unexpectedly. The process id was '3628'. The process exit code was '0x0'.

    点赞 评论 复制链接分享
  • weixin_40006265 weixin_40006265 4月前

    Can you upload your repo to some file sharing site (Dropbox, OneDrive) and email me the link? I'll share it with the team. My email address is on my GitHub profile.

    点赞 评论 复制链接分享
  • weixin_39975529 weixin_39975529 4月前

    Very carefully i'll say the issue 'might' be resolved. Last few updates been without issues. I modified access to the application folder to allow 'everyone' read access (didn't look into detail yet which user might have needed read access that was blocked previously). If i find the time i'll try to get more details.

    But is this is indeed the issue, something could be done to just throw an error and still complete the shut down.

    点赞 评论 复制链接分享
  • weixin_39618597 weixin_39618597 4月前

    -wang are there still issues that need investigation here?

    点赞 评论 复制链接分享
  • weixin_39975529 weixin_39975529 4月前

    Depends on how you look at it. My issues were resolved by giving 'everyone' read access to the folder. I still didn't look into which user was trying to read the folder but wasn't allowed.

    However, as a developer it might be worth investigating to prevent this issue, as to me it seems pretty severe. There are no errors, no messages, nothing pointing towards the reason why shutting down the application fails, and the only solution is a reboot of the server.

    The application hangs when the user tries to publish an update, or automatically every x time when IIS recycles the application / memory.

    点赞 评论 复制链接分享
  • weixin_39618597 weixin_39618597 4月前

    Without a repro, we are not able to investigate further into this issue so I'll close this issue for now. please reopen this issue if there is a repro you can provide.

    点赞 评论 复制链接分享
  • weixin_39528843 weixin_39528843 4月前

    Is this with 1.0 or 1.1 (just released this week)?

    点赞 评论 复制链接分享
  • weixin_39975529 weixin_39975529 4月前

    1..0.1. Prepped the update to 1.1 today, will push it to the server tomorow. Really hope this fixes the issue because it results in long downtimes of the site, often needing a full reboot of the server (and thus affecting other sites as well}.

    点赞 评论 复制链接分享
  • weixin_39781550 weixin_39781550 4月前

    Assigning to for investigation.

    点赞 评论 复制链接分享
  • weixin_39618597 weixin_39618597 4月前

    have you tried the latest releases of 1.1 and ANCM? Also, can you elaborate on how your application is hosted and how you are shutting down the app to publish an update?

    点赞 评论 复制链接分享
  • weixin_39975529 weixin_39975529 4月前

    I'll get back on the issue on thursday due to lack of time. I've already updated to 1.1, but havent tried any update since.

    The site is hosted on IIS in its own application pool, and targets the full .net framework.

    I usually try to publish through visual studio, with the following publish settings: <WebPublishMethod>MSDeploy</WebPublishMethod> <MSDeployPublishMethod>WMSVC</MSDeployPublishMethod> <EnableMSDeployBackup>False</EnableMSDeployBackup> <EnableMSDeployAppOffline>True</EnableMSDeployAppOffline> <UsePowerShell>True</UsePowerShell>

    When publishing, the app_offline.htm gets created but then an error is thrown (will get back on the details thursday). Afterwards, trying to copy the files over manually fails because the .exe is in use. Trying to kill the process with task manager just says 'access denied', using process hacker the exception says (trying to access an exiting process'.

    I've also tried to take the site and app pool offline through IIS manager but this results in the same issues.

    Non 'standard' things about the site:

    • It uses Telerik DataAccess instead of Entityframework because the database model library is shared with a WPF client for administration that used Telerik data access.
    • NLog with the NLog asp.net core wrapper

    These problems didn't exist early on. Not sure but they might have started since the 1.0.1 update. Development was minimal when i upgraded so thats why I might not have noticed the issue immediatly.

    点赞 评论 复制链接分享
  • weixin_39528843 weixin_39528843 4月前

    ANCM: AspNetCoreModule

    点赞 评论 复制链接分享

相关推荐