<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ihor Bodnarchuk</title>
    <description>The latest articles on DEV Community by Ihor Bodnarchuk (@ibodnarchuk).</description>
    <link>https://dev.to/ibodnarchuk</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F703053%2F256c802d-8f95-418b-a559-2b196d548c97.jpeg</url>
      <title>DEV Community: Ihor Bodnarchuk</title>
      <link>https://dev.to/ibodnarchuk</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ibodnarchuk"/>
    <language>en</language>
    <item>
      <title>Debugging Azure App Service from Visual Studio</title>
      <dc:creator>Ihor Bodnarchuk</dc:creator>
      <pubDate>Fri, 10 Sep 2021 17:39:43 +0000</pubDate>
      <link>https://dev.to/ibodnarchuk/debugging-azure-app-service-from-visual-studio-50ij</link>
      <guid>https://dev.to/ibodnarchuk/debugging-azure-app-service-from-visual-studio-50ij</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;This will later be included in a series of articles I plan on writing about my journey of building a SaaS on Azure.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Today I’m having issues with deployment slots for one of our Azure App Services. For some reason, our Staging slot is using some weird config nowhere to be found within our current codebase that’s deployed out of staging branch. Since &lt;code&gt;ASPNETCORE_ENVIRONMENT&lt;/code&gt; is set to Staging I expect out .NET 5 app to use config from &lt;em&gt;appsettings.Staging.json&lt;/em&gt; which doesn’t seem to be the case. To troubleshoot I needed to attach debugger to the live app but the steps outlined here &lt;a href="https://devblogs.microsoft.com/premier-developer/remote-debugging-azure-app-services/"&gt;https://devblogs.microsoft.com/premier-developer/remote-debugging-azure-app-services/&lt;/a&gt; didn't work. That bug was already reported and supposedly fixed by MS in VS v16.5 yet we are on v16.11 now and the issue is still there. Fortunately, user ZubairMunir-5725 saves the day with his workaround posted here &lt;a href="https://docs.microsoft.com/en-us/answers/questions/528107/unable-to-attach-remote-debugger-to-app-service-sl.html"&gt;https://docs.microsoft.com/en-us/answers/questions/528107/unable-to-attach-remote-debugger-to-app-service-sl.html&lt;/a&gt;&lt;br&gt;
In case the link becomes dead the steps are:&lt;br&gt;
1=&amp;gt; Latest Visual studio&lt;br&gt;
2=&amp;gt; Go to Debug tab&lt;br&gt;
3=&amp;gt; Click on Attach process&lt;br&gt;
4=&amp;gt; In Dialog there is Connection Target paste your site url without http like(myappservice.azurewebsites.net)&lt;br&gt;
5=&amp;gt; Hit the Refersh button&lt;br&gt;
6=&amp;gt; Again dialog apperies add your app service crediential username and password and check remember me&lt;br&gt;
7=&amp;gt; A list of process will be shwon to you just click on the w3sp process .&lt;br&gt;
8=&amp;gt; Now check debuger is attached and now you can debug .&lt;br&gt;
Note:Explanation of step 6 to get cridential&lt;br&gt;
There is two methods to get username and password&lt;br&gt;
1) Download publish profile and open in notepad++ there you can see the username and password.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;publishData&amp;gt;
&amp;lt;publishProfile profileName=”myappservice — Web Deploy” publishMethod=”MSDeploy”
publishUrl=”myappservice.azurewebsites.net:443"
userName=”{USERNAME}” userPWD=”{PASSWORD}” …&amp;gt;
&amp;lt;databases /&amp;gt;
&amp;lt;/publishProfile&amp;gt;
&amp;lt;publishProfile profileName=”myappservice — FTP” publishMethod=”FTP” …&amp;gt;
&amp;lt;databases /&amp;gt;
&amp;lt;/publishProfile&amp;gt;
&amp;lt;/publishData&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2) you can also get this username and password from azure portal&lt;br&gt;
i)=&amp;gt;Go to azure portal&lt;br&gt;
ii)=&amp;gt;Open your app service&lt;br&gt;
iii=&amp;gt;Developement center&lt;br&gt;
There is three tab on top right side click on FTPS Cridential&lt;br&gt;
there is the username and password .&lt;br&gt;
Note your app has to be in debug mode otherwise when setting up the breakpoint you will see this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tqkL3ehr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r0s393s71ieohxlbns7f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tqkL3ehr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r0s393s71ieohxlbns7f.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We are using Github actions to deploy our code so all I had to do was just update our .yml file located in /.github/workflows replacing Release with Debug&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- name: Build with dotnet
run: dotnet build --configuration Debug
- name: dotnet publish
run: dotnet publish -c Debug -o ${{env.DOTNET_ROOT}}/myapp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It can also be accessed via VS by right-clicking your Web project -&amp;gt; Publish…&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7eNnzFNv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ao0p7pepnzrstvcy0plh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7eNnzFNv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ao0p7pepnzrstvcy0plh.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Just another day in the life of a miserable MS stack developer, happy troubleshooting :)&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>dotnet</category>
      <category>azure</category>
      <category>visualstudio</category>
    </item>
  </channel>
</rss>
