Why don't you just disable ApplicationInsight when in debug using a web.config transform?
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.web>
<httpModules>
<add xdt:Transform="Remove" xdt:Locator="Match(name)" name="ApplicationInsightsWebTracking" />
</httpModules>
</system.web>
<system.webServer>
<modules>
<add xdt:Transform="Remove" xdt:Locator="Match(name)" name="ApplicationInsightsWebTracking" />
</modules>
</system.webServer>
</configuration>
I had similar issues and the answer to this question explained to me how to go about using this snippet in my dev environment (ie. not in the publishing pipeline).