Sunday, April 29, 2018

How to generate secret for API key for Heroku deployment using Travis CI


For some reasons recommended in the Travis-CI documentation, way does not work. Please find below what they recommend.

travis encrypt $(heroku auth:token) --add deploy.api_key

Travis-CI fails with the following error:

not logged in invalid option "--api_key="

How to generate a correct secure string

  1. Navigate to your Heroku account:
  2. Find API key section and copy key
 Heroku API Key

  1. Go to project root directory
  2. Run the following command:

travis encrypt <api-key> -r <github-user>/<repo-name> --add deploy.api_key

That script will add a secure string to .travis.yml.

Tuesday, April 3, 2018

Attaching debugger to IIS process in Visual Studio


The developer needs to debug web application. The web application is running on IIS.

Attach to process

Open your project in Visual Studio and build it. Then go to Debug → Attach to Process (Ctrl + Alt + P).  See picture below.

Attaching to IIS process in Visual Studio
Attaching to IIS process in Visual Studio

In 'Attach to' section select appropriate code type if you know it, otherwise you can keep it as default 'Automatically determine the type of code to debug'. In such case, the appropriate debugger will be selected based on the kind of code that is running.

To make sure that 'Available processes' windows shows your IIS process, check 'Show processes from all users' checkbox. Then use the filter to find all aspnet_wp.exe, w3p.exe, or w3wp.exe processes. 

Multiple w3wp processes

Which w3wp.exe PID corresponds to which application pool? This is the question you will face if you have multiple web applications running on your machine.

In IIS7+ and Windows 2008+, you can use appcmd.exe utility to determine which PID belongs to which IIS process. Open command prompt as Administrator → navigate to %windir%\system32\inetsrv\ → run following command:

cd/d %windir%\system32\inetsrv\

appcmd list wp

The output of the command will show which PID belongs to which IIS process. See picture below.

The output of appcmd utility execution
The output of appcmd utility execution

Please read the following article to learn more about AppCmd: Getting Started with AppCmd.exe