locked
.NET 5 debugging RRS feed

  • Question

  • User1397682834 posted

    I'm trying to debug my webapi with IIS

    When I first published the app it created an application pool with the same name of the app.

    That's not good since I want to use my own app pool.

    So after changing the virtual application folder to use my app pool, now when I run debug in VS 2019, it tells me that it can't start the app pool or something because it's trying the old one.

    And no, starting my url manually and then attaching a debug to the w3wp process won't help me because I want to debug the Statup.cs file and once that process is up, that code won't be ran anymore.

    What do I do?

    Sunday, December 20, 2020 11:37 AM

Answers

  • User-474980206 posted

    Not sure what up mean by my own app pool, but asp.net core hosting requires a unique app pool per application. this is because asp.net core does not support app domains.

    anyway, it’s a lost cause. You can not easily debug startup. You should use error logging instead. But if you need to debug, add a sync delay in startup for long enough that you can attach the debugger.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, December 20, 2020 7:52 PM

All replies

  • User-474980206 posted

    Not sure what up mean by my own app pool, but asp.net core hosting requires a unique app pool per application. this is because asp.net core does not support app domains.

    anyway, it’s a lost cause. You can not easily debug startup. You should use error logging instead. But if you need to debug, add a sync delay in startup for long enough that you can attach the debugger.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, December 20, 2020 7:52 PM
  • User1397682834 posted

    I had to use a specific app pool that I already have. It's used only for this project. But it has a specific user running it which is used for encrypting data all over the place using DPAPI. Then to change the app pool that VS 2019 creates would require knowing that user's password which is not available. And changing that password would invalidate all encrypted data. Basically. But I think the delay approach will work.

    It also bothers me that I have to manually do an iisreset each time I build my project because the dll is locked.

    VS does it automatically but since I broke it by changing the app pool of my project manually...

    Monday, December 21, 2020 3:17 PM