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 :: 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
    AuthFlags
    Path
    AppFriendlyName
    EnableDirBrowsing
    AccessRead
    AccessExecute
    AccessWrite
    AccessScript
    AuthNTLM
    EnableDefaultDoc
    DefaultDoc
    AspEnableParentPaths

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.

Implementation:
.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.

Code:
WebSettings.cs:
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)
          {
               Auth_Type = "INTEGRATED WINDOWS ACCESS ENABLED";
          }
          if (AuthValue == (MD_AUTH_ANONYMOUS + MD_AUTH_NT))
          {
               Auth_Type = "INTEGRATED WINDOWS + ANONYMOUS ACCESS ENABLED";
          }
          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;
     }

Main.cs
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];
lstIISProperty.Items.Clear();
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);
    lstIISProperty.Items.Add(listViewItem[i]);
    }
}



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

clock May 7, 2021 12:19 by author Peter

Introduction
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.

Background
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.



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