Jupyter Notebook - problems with dotnet-try under IIS

I keep encountering things when setting up Jupyter! After I got it running under IIS I went to bed then picked it up the next evening, tried to install the C# and F# kernels from dotnet try. Of course I hit two snags:

Issue 1. C# and F# Kernels aren't available at all

I installed it as usual by opening up Windows Terminal, source-ing my venv, installing dotnet-try globally and installing the dotnet try kernel. I suspected I was gonna encounter something a little odd - I wasn't sure if the dotnet try would respect the venv when I installed jupyter. Turns out the kernel got installed in a weird location (under AppData/Roaming rather than in my venv dir). I did a bit of experimenting and this was how I ended up resolving the issue. First I updated the PATH so that it included both the venv directory and the dotnet tools directory:

    <aspNetCore processPath="python.exe" 
                arguments="launch.py"
                stdoutLogEnabled="true" 
                stdoutLogFile="logs\stdout">
      <environmentVariables>
        <environmentVariable name="PYTHONPATH" value="." />
        <environmentVariable name="PATH" value="%PATH%;C:\Users\sean\.dotnet\tools;.\venv\Scripts" />
      </environmentVariables>    
    </aspNetCore>

Then I opened the terminal and ran the kernel install steps once more:

Once that was in place I could create a new notebook and run F# code:

Issue 2. Notebooks weren't saving

I was getting a little "Method Not Allowed" notification when I made some changes to my notebooks - so things like saving, renaming and deleting notebooks didn't work. The issue was that IIS was preventing HTTP verbs other than GET and POST (so PUT, PATCH and DELETE were getting blocked). The solution for me was to remove WebDAV handler and module - which again involved adding a couple of lines to my Web.config. It's maybe easier to just show the final Web.config to see everything together:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      <remove name="WebDAV" />
    </handlers>

    <modules>
      <remove name="WebDAVModule" />
    </modules>
    
    <aspNetCore processPath=".\venv\Scripts\python.exe" 
                arguments="launch.py"
                stdoutLogEnabled="true" 
                stdoutLogFile="logs\stdout">
      <environmentVariables>
        <environmentVariable name="PYTHONPATH" value="." />
        <environmentVariable name="PATH" value="%PATH%;C:\Users\sean\.dotnet\tools;.\venv\Scripts" />
      </environmentVariables>    
    </aspNetCore>
  </system.webServer>
</configuration>
So yet another hack - I'm starting to wonder if I'm using it in an unintended or unexpected way. I've put it all up on a git repo for anyone who wants to quickly get it up and running without thinking too hard.