Setting up Web Push Notification on .NET Server (IIS Manager)
After you have signed up for a new account on PushAlert.co, head to the Dashboard and into the Integrate section. You can setup web push notifications for both HTTP and HTTPS websites.
For HTTPS websites, you also need to copy two files to the root of your website - manifest.json and sw.js.
Now, if you are running an older version of IIS then you also need to add json as a MIME type in IIS Manager. Its pretty easy and there are two ways to do it:
1. Using IIS Manager:
- Search for IIS Manager and open it.
Browse to the Server where your website is hosted.
- Locate Mime Types and see if json type is defined. If it exists, no need to make any changes and you can skip all the next steps. Your integration is complete.
- If it doesn’t exist, right click on the Mime Types page and then click on Add.
- In the File name extension field enter - json and set MIME type as “application/json”.
- Hit OK and you are all set.
2. Using Application Host Config file (applicationhost.config):
First you need to find applicationhost.config file, based on your installation the file will either be located in one of the following locations:
- Documents > IISExpress
- Once you have found this file, you need to open it in an editor in Administrator mode with elevated permissions to change its contents.
Search for the following string:
- <staticContent lockAttributes=”isDocFooterFileName”>
- Then, see if you can find json listed in the mimeMap.
If it is not listed add this line among the other fileExtension listing:
- <mimeMap fileExtension=”.json” mimeType=”application/json” />
- Then save the file and Restart IIS.
- If you are unable to save the file, you must not have opened it in administrator mode. You can open your favorite editor in administrator mode by searching for it in the start menu and then right click on it, tap on More > Run as administrator.