After Configuring IIS on VM Server - How to access sites hosted on IIS On VM over internet

December 25, 2020 0 comments

 Once we are done with Installing IIS on Azure VM, we need to open port 80 to access hosted website from internet.

Check - How to Setup IIS On Azure VM

To Enable port 80, simply login to your Azure portal, and click on VM

VM networking

Then click on Networking, on click of Networking, network interface will open up, then clikc on Add Inbound port rule.

And add port 80

Adding Port 80 to Azure network inbound rule

Once you create a rule, simply hit the Azure VM IP address from browser, it should show you default IIS page.


This is how we allow HTTP traffic to IIS hosted site on Azure VM server

How To Setup IIS on Azure VM - Configure IIS on Azure VM

December 25, 2020 0 comments

 Once we have setup the Azure VM, next important thing is to Setup an IIS in the windows server and enable it to access from anywhere. So that we can host our web application on VM and access it over an Internet.

In this article, we shall achieve it.

To Enable IIS on Azure VM server

  • Under Server Manager click on Manage > Add Roles and Features
Azure vm - Server Manager- Manage - Add Roles and Features


Once we click on Add Roles and Features following screen will appear

Add Roles and Features Wizard

Click next and go to Select Installation Type, select Role-Based or feature-based installation

Add Roles and Features Wizard - Installation Type

On click of Next you will go to Server Selection screen, here you will see default server under server pool. Make sure Select a server from the server pool is selected

Add Roles and Features - Select Destination server

Now in Server Roles select Web Server (IIS)

Add Roles and Features - Web Server (IIS)

Once we select Web Server (IIS) and click on Next, one pop up will appear, click on Add Features, check following image

Add Toles and Features - Add Features

Now select .Net framework 4.5 Features and any other required feature from list and click on next

Add Roles and Features - .Net Framework

Click on Next 

Add Roles and Features - Web Server Role (IIS)

Click on Next and Select from Role Services

Add Roles and Features Wizard - Role Services

Now you will see confirmation screen 

Add Roles and Features - Confirmation

Now on click of install, IIS will be installed on Azure VM. 

Add Roles and Features - IIS Installation

You can run IIS using inetmgr command

Do Win+R and type inetmger and IIS will open up.


This is how we should Setup IIS on Azure VM 




SqlException: Cannot open database "DATABASE" requested by the login. The login failed. Login failed for user 'IIS APPPOOL\APPPOOLNAME'.

March 14, 2019 0 comments
While deploying web based and Mobile based Attendance system on IIS and MSSQL2017, I got following error.
  1. Project developed using Entity Framework Core and MVC .net Core 2.2
  2. To deploy web application in IIS, I published core 2.2 web application and put it under IIS.
  3. Assigned new APP Pool with with No Managed Code for .NET CLR Version.
I got following SQL related error

An unhandled exception occurred while processing the request.

SqlException: Cannot open database "DATABASE" requested by the login. The login failed. Login failed for user 'IIS APPPOOL\apppoolname'.

System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, object providerInfo, string newPassword, SecureString newSecurePassword, bool redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, bool applyTransientFaultHandling, string accessToken)

To resolve this issue, simply create User named 'IIS APPPOOL\apppoolname in SQL

SqlException: Cannot open database "DATABASE" requested by the login. The login failed. Login failed for user 'IIS APPPOOL\apppoolname'

After creating user, assign it to your respective database and give db permissions to that user.

This will resolve the issue.



Swapping to Development environment will display more detailed information about the error that occurred.

March 14, 2019 0 comments
While developing Employee Mobile based and Web based Attendance system in .net core 2.2.
  1. I published application using VS2017
  2. Then I put this application in IIS and assigned an Application Pool with No Managed Code for .NET CLR Version.
  3. When I was running my application on Chrome browser, I got following error.

Swapping to Development environment will display more detailed information about the error that occurred.
Error. An error occurred while processing your request. Development Mode Swapping to Development environment will display more detailed information about the error that occurred.
Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application.

To resolve this error and check actual error in details, open web.config file and add following code



<aspnetcore>
  <environmentvariables>
       <environmentvariable name="ASPNETCORE_ENVIRONMENT" value="Development">
   </environmentvariable></environmentvariables>
</aspnetcore>