IIS 7.5 and IIS 8.0 European Hosting

BLOG about IIS 7.5 Hosting, IIS 8.0 Hosting and Its Technology - Dedicated to European Windows Hosting Customer

IIS Hosting Europe - HostForLIFE.eu :: How to Access the Site Using Domain Name Instead of localhost in IIS?

clock June 11, 2021 08:37 by author Peter

Whenever we host a website in Internet Information Services (IIS), we previously would access the website with localhost or with that specific machine IP address in the manner of: http://localhost/TestSite/TestPage.aspx

Did you ever think of accessing your website with a domain name, such as http://www.testsite.com, instead of http://localhost/testsite or on your local machine?

How can I tell my IIS that http://www.testsite.com is pointing to the files on my local computer and to not try to access the internet?

The answer behind all these questions is the Hosts file.

This will be in <Windows Root Folder>\System32\Drivers\etc\. In general if the Windows Operating System is installed in the C drive then it will be C:\Windows\System32\drivers\etc. You can open this file in Notepad, Notepad++ or any text editor that you have. If you open this file, it will be as follows.

local host

Note: You need administrator privileges to save your changes in this file.

Case 1

If you want to create a new website then that is possible for accessing using a domain name. Use the following procedure.

Open IIS (Click WIN+R, enter inetmgr in the dialog and click OK. Alternatively, search for IIS Manger in start window).

Expand the Server node and click on the Sites folder.

Click on Add Website in the Actions pane.

Note: If need any help for the preceding procedure then please check my blog article How to setup basic website in IIS 8.

Enter the details in the Add Website window as follows.

Click on Ok to create the website.

If you try to browse your website now, you will see an alert in Chrome that your webpage is not available. You will see the same kind of issue in other browsers also.

This is because the address you entered will search in the internet instead of your localhost. To overcome this open the Hosts file in any text editor and add the following command. www.testsite.com

Now try to reload the page by clearing the browser cache. It will work as follows.

Case 2
If you want to access the website using the domain name you created then use the following procedure.

Open IIS (Click WIN+R, enter inetmgr in the dialog and click OK. Alternatively, search for IIS Manger in start window).

Expand the Server node and then expand Sites folder.

Click on the Website that you want to access using a domain name and then click on Bindings in the Actions pane.

Select the binding of type http and then click on Edit. This will open a new window as follows:

Enter the host name in the provided text box.

I am entering this as www.google.com because I want to access my site with a Google address.

Now make the change in the hosts file as we did in #6 in case1.

After having made this change you can access your local website with the Google address.

Note: The changes you are making in the hosts files are applicable only to that specific local machine in which the file exits.


IIS Hosting Europe - HostForLIFE.eu :: Working with IIS Metabase with DirectoryServices

clock May 21, 2021 08:00 by author Peter

While working with the IIS we all like to know the settings done on the Virtual Directory are correct or not. So we are going to see how to do that programmatically.
To check some properties of the IIS (Virtual Directory) of Web based application after  install, one can create custom application for that.

There are list of IIS Properties which we can get after post installation. The list of properties exposed by the IIS API or Web Settings Property is mentioned below

The above settings are configured in the Metabase of the IIS.

IIS Metabase:
IIS Metabase is a structure where IIS configuration settings are stored. The metabase configuration and schema for IIS 4.0 and IIS 5.0 were stored in a binary file, but from IIS6.0 the configuration and setting is stored in single binary file (MetaBase.bin), with plain text, Extensible Markup Language (XML) formatted files named MetaBase.xml and MBSchema.xml.  You can navigate through the IIS Metabase using MetaEdit or Metabase Explorer. The Metabase is based on a hierarchical design with inheritance. Each object in the metabase has a KeyType. The KeyType property specifies the type of metabase key.

.Net provides the namespace which is used to get the properties of the IIS Virtual Directory. .Net have the "System.DirectoryServices" namespace which exposes the DirectoryEntry Class.

public class WebSettings
     //Authentication Bitmask Values
     //Constant Value Description
     public const int MD_AUTH_ANONYMOUS = 0x00000001;
     //Anonymous authentication available.
     public const int MD_AUTH_BASIC = 0x00000002;
     //Basic authentication available.
     public const int MD_AUTH_NT = 0x00000004;
     //Windows authentication schemes available.
     string Auth_Type;
     public string calc(int AuthValue)
          if (AuthValue == MD_AUTH_ANONYMOUS)
               Auth_Type = "ANONYMOUS ACCESS ENABLED";
          if (AuthValue == MD_AUTH_BASIC)
               Auth_Type = "BASIC ACCESS ENABLED";
          if (AuthValue == MD_AUTH_NT)
          if (AuthValue == (MD_AUTH_ANONYMOUS + MD_AUTH_NT))
          if (AuthValue == (MD_AUTH_ANONYMOUS + MD_AUTH_BASIC))
              Auth_Type="BASIC + ANONYMOUS";
         if (AuthValue == (MD_AUTH_ANONYMOUS + MD_AUTH_NT))
              Auth_Type = "INTEGRATED + ANONYMOUS";
         if (AuthValue == (MD_AUTH_BASIC + MD_AUTH_NT))
             Auth_Type = "BASIC + INTEGRATED";
         if (AuthValue == (MD_AUTH_ANONYMOUS + MD_AUTH_BASIC + MD_AUTH_NT))
             Auth_Type = "ANONYMOUS + BASIC + INTEGRATED";
          return Auth_Type;

string serverName;
string vDir;
serverName = System.Environment.MachineName;
vDir = "DirectoryName";
vdir = new DirectoryEntry("IIS://" + serverName + "/W3SVC/1/ROOT/" + vDir);
wbs = new WebSettings();
string[] sComp = new string[12];
sComp[0] = "AuthFlags";
sComp[1] = "Path";
sComp[2] = "AppFriendlyName";
sComp[3] ="EnableDirBrowsing";
sComp[4] ="AccessRead";
sComp[5] ="AccessExecute";
sComp[6] ="AccessWrite";
sComp[7] ="AccessScript";
sComp[8] ="AuthNTLM";
sComp[9] ="EnableDefaultDoc";
sComp[10] ="DefaultDoc";
sComp[11] ="AspEnableParentPaths";
ListViewItem[] listViewItem = new ListViewItem[12];
for (int i = 0; i < sComp.Length; i++)
    //lstComponents.MultiColumn = 2;
    lstIISProperty.Sorting = SortOrder.Ascending;
    if (sComp[i] != null)
    listViewItem[i] = new ListViewItem(new string[]{ sComp[i], IISPropertyValue(sCompi]), fnExpected_Value(sComp[i])}, -1);

IIS Hosting Europe - HostForLIFE.eu :: Solution to "Unable to Launch the IIS Express Web Server"

clock May 7, 2021 12:19 by author Peter

Today I encountered the issue "Unable to launch the IIS Express Web Server" while I was running my Visual Studio 2012. So I thought of sharing how to resolve that issue. I hope it will help someone.

In my team we have 5 to 10 members. Since we wanted to do a build for our current application, I used "Get the Latest files from the server". (We are using TFS.) Then when I run my application I was getting this error.

The cause of this error is, someone has checked in the solution file with his port number (the port number he was using). When I took the latest, it was set in my solution file also. We must take the latest solution file only when it is required. So here I will share the remedy for the preceding issue.

Procedure to solve this issue

Step 1
Right-click on your solution and select Properties as shown in the following figure.

Step 2
Select “Web” from the left menu.

Step 3
Under “Use local IIS server” change the port number from http://localhost:58030/ to another one.

Step 4
Here I have changed http://localhost:58030/ to http://localhost:58031/ .
Bingo! We have done it.

Step 5
Now please run again your application. The issue will be solved.

IIS Hosting Europe - HostForLIFE.eu :: Create FTP and Web IIS Virtual Directory using C#

clock April 28, 2021 08:12 by author Peter

In this example we will create a Windows Form Project that will create new FTP and Web IIS Virtual Directories from code based on the name and path specified by the user. You can create virtual directories on the local computer by specifying the server name as "localhost" or you can create the virtual directory on a remote computer by specifying the machine name.

We make use of the DirectoryServices namespace for creating the Virtual directory.

Step 1: Create the Project and the basic User Interface.

Create a new Visual C# Windows Forms Project and add controls on the default form as shown below.

Figure 1: User interface

Figure 1: User interface 

Control Property Name Property Value
Label Text Server
TextBox Name txtServer

Text localhost
Label Text Virtual Directory Name
TextBox Name txtVDirName
Label Text Virtual Directory Path
TextBox Name txtVDir
GroupBox Text Virtual Directory Type
RadioButton Label Web
RadioButton Label FTP

Label Name lblStatus

The windows form allows the user to specify the server name on which to create the virtual directory, the virtual directory name, the virtual directory path, the type of virtual directory (FTP or Web). We will now add the code to create the virtual directory when the button is clicked. The code is specified in the code listing below.

We first determine if the user has selected to create an FTP virtual directory or a Web Virtual Directory. Based on this selection, we set the values for the schema name and a part of the path for the IIS root to create the node in. We now create a DirectoryEntry object for the root of the IIS directory on the server specified by the user which points to the web or ftp root. We then add a node to the children collection of the root node and set the value for the Path property of the newly created node. If the user selected to create a web virtual directory, we set the new node as an application. We then commit the changes and close the directory entry nodes. Finally we display the status - whether successful or error, to the user. You need to make sure that the user has the privileges to create the new virtual directories before running the sample.
private void button1_Click(object sender, System.EventArgs e)
string strSchema= "";
string strRootSubPath = "";
if (radioButton1.Checked)
strSchema = "IIsWebVirtualDir";
strRootSubPath = "/W3SVC/1/Root";
if (radioButton2.Checked)
strSchema = "IIsFtpVirtualDir";
strRootSubPath = "/MSFTPSVC/1/Root";
if (strSchema == "")
strSchema = "IIsWebVirtualDir";
strRootSubPath = "/W3SVC/1/Root";
DirectoryEntry deRoot= new DirectoryEntry("IIS://" + txtServer.Text + strRootSubPath);
DirectoryEntry deNewVDir = deRoot.Children.Add(txtVDirName.Text,strSchema);
// Create a Application
if (strSchema == "IIsWebVirtualDir")
// Save Changes
lblStatus.Text = "Virtual Directory " + txtVDirName.Text + "(" + txtVDir.Text + ") has been created";
catch (Exception ex)
lblStatus.Text = "Error: " + ex.Message;

Code Listing : Button Click event handler code - create a new virtual directory.
Please refer to the complete code listing available for download at the top of the article.

Figure : Creating a virtual directory from our program. This creates a FTP Virtual directory named "TestFTPDir" pointing to path "C:\Temp"

IIS Hosting Europe - HostForLIFE.eu :: Enable IIS in Windows 7

clock April 22, 2021 08:13 by author Peter

When I worked on my friend’s desktop, I just wanted to create a virtual directory. So I went to “Run” and typed “inetmgr”, then enter. Even though he had installed VS2010, but he did not installed/enabled IIS in the local machine.  
I guess IIS is disabled by default when you install Windows. So here I’m going to explain the steps on how to install/enable IIS in Windows 7 system.
Step 1: Go to "Control panel" and select "Programs and Features" or simply type “appwiz.cpl” in a run.

Step 2: On the left-hand side, click on the link “Turn Windows features on or off”.

Step 3: As a result, you got “Windows Features” popup in that check the checkboxes as shown below.


Step 4: That’s it! Windows will automatically install it! Now you can access the IIS by typing the command “inetmgr” in Run.

IIS Hosting Europe - HostForLIFE.eu :: Stop Sharing a Drive/Folder by Using Windows Interface

clock March 30, 2021 06:49 by author Peter

In this article you will learn how to stop sharing a drive/folder using a Windows interface.

Step 1
First of all open the "Computer Management" from the Start Menu of your system.

Step 2
Now your Computer Management Window will be opened that will look like this:

Step 3
On the left-hand side of Computer management you will see many options, one of them will be "Shared Folders", expand this option.

Step 4
On expanding the Shared Folders you will see that three options are available to choose from, one of them will be named "Shares", click on this option to see the folders and drives that are shared.

Step 5
Now right-click on a folder or drive you want to stop sharing and click on "Stop Sharing".

Step 6
Now a Confirmation Message Box will pop-up that will again confirm you that you really want to stop sharing, click on the "Yes" button to remove this folder from the sharing folder option.

IIS 8.5 Hosting - HostForLIFE.eu :: Enable IIS Server to Serve .mp4 Files through web.config File

clock March 26, 2021 08:44 by author Peter

Now, most of the websites are being developed using HTML5 and using videos on the background. It is an easy job to use  the video tag.. It is advised to serve video files using a CDN, however, in case you want to host videos from your own server, you need to configure IIS to server .mp4 files. In case you don’t configure it, you will get a 404 error or an error saying “The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.” Again, if you have got access to IIS , it’s a great thing but what if you’re hosting the website on a shared server where you don’t have access to IIS Server? In this post, we will see how can we enable IIS Server to serve .mp4 files through web.config file.

To allow IIS to server files, we need to configure proper mimeType for the required files. The mimeType for a .mp4 is video/mp4. Just add the following line in your web.config file under system.webServer tag and you should be good to go.

    <system .webServer>  
            <mimemap fileExtension=".mp4" mimeType="video/mp4"></mimemap>  

Once you do the above changes, your web server should start serving .mp4 files without issues. Hope this blog post helps you! In case you know other ways of doing the same, do let me know via comments.

IIS 8.0 Hosting - HostForLIFE.eu :: Publish And Deploy ASP.NET Core MVC On IIS

clock March 5, 2021 08:51 by author Peter

ASP.NET Core is able to run as a standalone Application (out of process Console Application). It does not host inside IIS, which does not require IIS to run an application. ASP.NET Core app has its own self-hosted Web Server and processes the requests, which internally use the self-hosted Server instance. ASP.NET Core uses Kestrel Server to host the core Application but it does not support all the features of the Server such as IIS.

In older ASP.NET Web applications, everything is hosted inside IIS Worker process, which can also refer to an Application pool. The Application Pool hosts our Web Application and our Web Application is instantiated by the built-in ASP.NET hosting features in IIS. The ASP.NET Core Application does not run in the IIS worker process but runs as a separate out of process Console Application, which runs its own Web Server, using Kestrel Web Server. If we run on Windows, we may want to run Kestrel behind IIS to gain infrastructure features such as port forwarding via host headers, life cycle and certificate management.

ASP.NET Core Application is a standalone console Application that is invoked through the "dotnet" runtime command. It does not load into the IIS worker process but loads in the native IIS module called "AspNetCoreModule" which runs the console application. We need to install the AspNetCoreModule on the Server and it is part of ASP.NET Core Server Hosting Bundle.

All IIS applications are run on application pool. For ASP.net core, application pool must set to use No Managed Code. The Application pool acts only as a proxy to forward the requests. There is no need to instantiate a .NET runtime.

The primary job of AspNetCoreModule is to ensure that our Application gets loaded when the first request comes. All incoming Http request are handled by AspNetCoreModule and then it is routed to ASP.NET Core Application. Kestrel picks up the incoming request and passes into ASP.NET Core middleware pipeline that subsequently handles the request and passes to the Application logic, which is the same as the response of the Application which is pushback to the IIS and then Http client.
AspNetCoreModule is configured via the web.config file, which is stored in an Application root folder, which contains the startup command and argument. The dotnet is a startup command and our Application main DLL, which is used to launch application as aargument.
The Web.config file looks, as shown below.
    <?xml version="1.0" encoding="utf-8"?>  
          <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>  
        <aspNetCore processPath="dotnet" arguments=".\FirstCoreApplication.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>  

Publishing ASP.NET Core Application
To host our Application on IIS, we first need to publish it. There are two ways to publish .NET Core Application
    Using CLI command dotnet publish.
    Using Visual Studio Publishing feature.

Before publishing ASP.NET Core Application, we make sure that we are including all the required folders in PublishOptions node of project.json file. This node looks, as shown below.
    "publishOptions": {  
      "include": [  

Using CLI command “dotnet publish”
.NET Core Application also supports CLI. Using CLI tool, we can create, build and publish the .NET Core Application. The "dotnet publish" command compiles the Application and publishes the Application with the project dependencies (specified in project.json file) and puts it into a specified folder.

    >dotnet publish  

Using Visual Studio Publishing feature
To publish our application, using Visual Studio, the first step is to right click on the project which we want to to publish and select publish option. Next step is to select custom option and enter the profile name. Once the profile is created, we need to select publishing method. Here, we have four different publishing methods, namely File system, Web deploy, Web deploy pack and FTP. In this example, I have selected File System as publish option and also need to pass target location.
In the next step, we can select the configuration, target framework and some other publish option. When we click Publish button, Visual Studio publish requires file in to the selected folder.

Host publish folder on IIS Manually
To host ASP.NET Core Application on IIS, we must have Windows 7 or newer / Windows Server 2008 R2 or newer. To configure IIS on Windows machine, we need to turn on some IIS related features of Windows.

Once our Application is published, we can hook up IIS to the published folder. Now, I am going to create a virtual Application directory.

Now, I am creating ASPNETCore Application with .NET runtime "No Managed Code", as shown earlier.

IIS 8.5 Hosting Europe - HostForLIFE.eu :: How to Fix HTTP Error 503. The service is unavailable in IIS

clock May 20, 2020 08:27 by author Peter

Now, we are going to fix the HTTP Error 503 on IIS. The service is unavailable in IIS 8 is caused if application pool is paused or disabled as shown within the image below:

Steps to resolve HTTP Error 503. The service is unavailable are as follows:
1. First, Open your IIS and then go to Application Pool of the chosen web site. Here in this example the web site name is "test"
2. Choose the application Pool as shown within the picture below:

3. Click on the web site name within the Application Pool and so click on start as shown within the image below:

Browse the web site and the error would be resolved.

IIS 8 Hosting - HostForLIFE.eu :: Running an ASP.NET MVC Application on IIS 8

clock April 3, 2020 08:04 by author Peter

IIS has ever increasing amounts of security, you can’t publish a basic ASP.NET MVC website anymore and expect IIS 8 to host it without some additional work. The default config settings that the MVC uses are locked down in IIS, so it issues an error when you try to navigate to your fresh site.

Initially you may get a screen that says something bland and non-descriptive, like “Internal Server Error” with no further information. To get the more detailed error messages modify your web application’s web.config file and add the following line to the system.webServer section:

<httpErrors errorMode="Detailed" />

Now, you’ll get a more detailed error message. It will look something like this:



The key to the message is: This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".

The “Config Source” section of the error message will highlight in red the part that is denied.

In order to allow the web.config to modify the the identified configuration element you need to find and modify the ApplicationHost.config file. It is located in C:\Windows\System32\inetsrv\config. You’ll need to be running as an Administrator level user in order to modify the file.

Find the section group the setting belongs to, e.g.

<sectionGroup name="system.webServer">

Then the section itself:

<section name="handlers" overrideModeDefault="Deny" />

And update overrideModeDefault to "Allow" in order to allow the web.config to override it.

When you refresh the page for the website the error will be gone (or replaced with an error for the next section that you are not permitted to override)


About HostForLIFE.eu

HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.

We have offered the latest Windows 2016 Hosting, ASP.NET Core 2.2.1 Hosting, ASP.NET MVC 6 Hosting and SQL 2017 Hosting.

Tag cloud

Sign in