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

Windows Server Hosting - HostForLIFE :: How to Install the File Server Resource Manager (FSRM)

clock December 5, 2023 08:01 by author Peter

Overview
In this post, I'll walk you through the process of installing the file server resource manager correctly and quickly.


Prior to proceeding, let us clarify what file server resource manager is. It is a Windows Server role service that helps you organize and manage data kept on file servers. You can use FSRM to automatically classify files, perform tasks based on these classifications, set quotas on folders, and create reports monitoring storage usage.

The File Server Resource Manager (FSRM) should be installed first. In your sever dashboard click "add roles and features".

Step 4. Click "next".

Step 5. Click the "file and storage" arrow mark and again click the "file and iSCSI" arrow mark. After that, select "file server resource manager".

Step 6. Once you click "file server resource manager" you will see the message in this step click "add features".

Step 7. Click "next".

Step 8. Click "next".

Step 9. Click the "restart" option, and then you will get the warring message. After that click "yes" and then click "install".

Step 10. After that, you can see the installed wizard.

Conclusion
In this article, we all clearly understand how to install the file server resource manager in a proper method. If there is clarification regarding this topic, feel free to contact me.



IIS 8 Hosting - HostForLIFE :: Programmatically Create IIS Website and Application Pool Using C#

clock November 16, 2023 09:25 by author Peter

In this post, we will look at how to use a C# console application to create an IIS website and accompanying application pool programmatically. These tasks are typically performed by an IIS administrator.

We can use this application to automate those tasks. In Visual Studio 2010, construct a console application named IISAutomation and target.NET 3.5, as seen below.

Add a reference to Microsoft.Web.Administration, which may be found at C:WindowsSystem32inetsrv [IIS installation directory]. This assembly contains classes that can be used by a developer to administer the IIS Manager. First, we'll build an application pool with the code below:

private static void CreateAppPool(string pool name,bool enable32bitOn64, ManagedPipelineMode mode,string runtimeVersion="v4.0")
{
    using (ServerManager serverManager = new ServerManager())
    {
        ApplicationPool newPool = serverManager.ApplicationPools.Add(poolname);
        newPool.ManagedRuntimeVersion = runtimeVersion;
        newPool.Enable32BitAppOnWin64 = true;
        newPool.ManagedPipelineMode = mode;
        serverManager.CommitChanges();
    }
}


Here, we created an application pool by creating an instance of the application pool object. Then, we set the properties of the application pool, like the name, the .NET version to be used, and the committed changes by calling CommitChanges(). Similarly, we will create a website using the following code:
private static void CreateIISWebsite(string website name, string hostname, string phyPath, string app pool)
{
    ServerManager iisManager = new ServerManager();
    iisManager.Sites.Add(websiteName, "http", "*:80:" + hostname, phyPath);
    iisManager.Sites[websiteName].ApplicationDefaults.ApplicationPoolName = appPool;

    foreach (var item in iisManager.Sites[websiteName].Applications)
    {
        item.ApplicationPoolName = appPool;
    }

    iisManager.CommitChanges();
}

Here, we created a new website by creating an instance of ServerManager, adding it to the Sites collection setting its properties like name, physical path, and so on and committed the changes.

We will use the preceding methods in our Main method and create an application pool and a website using the following code:

static void Main(string[] args)
{
    Console.WriteLine("Do you want to create an Application Pool:y/n");
    string response = Console.ReadLine();
    if (response.ToString() == "y")
    {
        Console.Write("Please enter Application Pool Name:");
        string poolname = Console.ReadLine();
        bool isEnable32bit = false;
        ManagedPipelineMode mode = ManagedPipelineMode.Classic;
        Console.Write("Need to enable 32 bit on Windows 64 bit?y/n [Applicable for 64 bit OS]: y/n?");
        string enable32bit = Console.ReadLine();
        if (enable32bit.ToLower() == "y")
        {
            isEnable32bit = true;
        }
        Console.Write("Please select Pipeline Mode: 1 for Classic, 2 for Integrated:");
        string pipelinemode = Console.ReadLine();
        if (pipelinemode.ToLower() == "2")
        {
            mode = ManagedPipelineMode.Integrated;
        }
        Console.Write("Please select Runtime Version for Application Pool: 1 for v2.0, 2 for v4.0:");
        string runtimeVersion = Console.ReadLine()== "1" ? "v2.0" : "v4.0";

        CreateAppPool(poolname, isEnable32bit, mode, runtimeVersion);
        Console.WriteLine("Application Pool created successfully...");
    }
                Console.WriteLine("Do you want to create a website:y/n");
    response = Console.ReadLine();
    if (response.ToString() == "y")
    {
        Console.Write("Please enter website name:");
        string websiteName = Console.ReadLine();
        Console.Write("Please enter host name:");
        string hostname = Console.ReadLine();
        Console.Write("Please enter physical path to point for website:");
        string phypath = Console.ReadLine();
        Console.WriteLine("Please enter Application pool Name:");
        foreach(var pool in new ServerManager().ApplicationPools)
        {
            Console.WriteLine(pool.Name);
        }
        Console.WriteLine("");
        Console.Write("Please enter Application pool Name for web site:");
        string poolName = Console.ReadLine();
        CreateIISWebsite(websiteName,hostname,phypath,poolName);
        Console.WriteLine("Web site created successfully...");
        Console.ReadLine();
    }
}


Here, we set the attributes necessary for website and application creation by getting input from the console. Let's run the application and input the details as shown below:

We can develop websites and application pools more quickly and easily using this program. I'm wrapping things up here. I've attached the source code for your convenience. I hope everyone finds this article useful.



IIS 8 Hosting - HostForLIFE :: How Do I Deploy and Publish a.NET 7 Application in IIS?

clock August 22, 2023 12:50 by author Peter

This article walks you through the process of installing and publishing a.NET 7 application to Internet Information Services (IIS).


Step 1: Configure IIS (Optional)
If IIS is not already configured, we can use the procedures below to enable it.
Navigate to the Control Panel > Programs > Programs and Features > Turn on or off Windows features.
Increase the availability of Internet Information Services, World Wide Web Services, and Application Development Tools.

Step 2: On the IIS server, install the.NET Core Hosting Bundle.
Check that your server has IIS installed and configured correctly. Otherwise, you can proceed with the optional procedures listed above.
Ascertain that the required components for hosting.NET 7 applications are enabled. The hosting package includes the.NET Core Runtime,.NET Core Library, and the ASP.NET Core Module.

After installation, please restart the server.

Step 3: Save to a File Folder
Right-click the project you wish to deploy in Visual Studio and select publish.

Click on Folder > Next > Folder location will populate the default path as “bin\Release\net7.0\publish\”. > Click on Finish > Publish.

OPTIONAL - An alternative method for generating published files,
Navigate to the root directory of your.NET 7 project in a terminal.
To publish your application, use the following command:
dotnet publish -c Release -o PublishOutput

This will compile your application in Release mode and generate the necessary files in the Publish folder.

Step 4. Copy Files to Preferred IIS Location
Now, copy the published files to the location where they should be stored. In our case, let's copy the files to C:\inetpub\wwwroot\EmpoyeeAPI.


Step 5: In IIS, create an application and configure the application pool.
On your server, launch the IIS Manager.
To host your application, either create a new site or use an existing one. Select "Add Website" from the context menu when you right-click on the "Sites" node.
Provide a site name, a physical path (to the previous step's PublishOutput folder), and an optional hostname.

Because.NET 7 uses the.NET Core runtime, make sure the.NET CLR version is set to "No Managed Code."
Select Application Pools > Choose the name of the application pool > Configure the.NET CLR version to "No Managed Code" > Select "Integrated" as the pipeline mode.

Step 6. Test your app after deployment
After configuring the site, try accessing it through a web browser. Make sure everything is working as expected.

Important note: Because we are delivering Web API in our situation, the Swagger UI middleware is often retained within the app.Environment.Check the IsDevelopment() function. I kept this swagger middleware outside of this condition for demonstration purposes so that we could test the page in a browser.



IIS 8 Hosting - HostForLIFE :: ASP.NET Core Application Remote Debugging on a Remote IIS

clock July 26, 2023 08:45 by author Peter

You may have experienced the situation where your ASP.NET Core application runs smoothly while developed on your PC and in Visual Studio, but encounters issues and fails to produce the desired results when published on IIS. In this circumstance, remote debugging is precisely what can be helpful.

How does Remote Debugger function?
You can debug input requests to IIS through Visual Studio by using a remote debugger, which is positioned between IIS and Visual Studio and transmits queries from IIS to Visual Studio.

Before configuring Remote Debugger, please note the following considerations:

  • Remote Debugger is not available if the IIS machine and Visual Studio machine are connected through a proxy.
  • If the connection between the IIS machine and the Visual Studio machine has high latency or low bandwidth, then using Remote Debugger is not recommended.

Prerequisites

  • Install Remote Debugger on IIS machine
  • Check that the required ports are open in the firewall (by default, Port 4026 fot for Visual Studio 2022 or Port 4024 for Visual Studio 2019 and optionally UDP Port 3702 for discovery)
  • The application should be deployed to IIS using Debug configuration
  • The application deployed to IIS and the source code in Visual Studio should be exactly the same. Otherwise, the breakpoints in Visual Studio will not be hit.

How to Configure Remote Debugger?
1. Install Remote Debugger on the IIS machine. To install Remote Debugger, you can follow one of these two options:
If you have Visual Studio installed, then you can copy Remote Debugger from the Visual Studio installation path to the IIS machine. Remote Debugger usually is located in the following path: C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Remote Debugger. If you have installed Visual Studio on other locations than the C:\Program Files, then you need to change the path respectively. Also, if you have installed Visual Studio other than the 2022 or Preview version, then the path should change respectively too.
Download the Remote Debugger and install it on an IIS machine.
You can download the Remote Debugger from the following url: Download Remote Debugger

2. Suppose that we have followed the first option so in order to start the Remote Debugger on the IIS machine, double click on msvsmon.exe to run the Remote Debugger. After running the msvsmon.exe following window will be opened:


As it is shown in the following image, Remote Debugger is up and waiting for new connections through port number 4026. In the following image, VAHID-LEGION is the name of the IIS server. Now that we have Remote Debugger up and run. Next, we need to go to the Visual Studio and try to connect to Remote Debugger.

3. In Visual Studio, go to Debug>Attach to Process

4. In Connection target, enter the IIS machine address as specified in msvsmon.exe and click on find.

3. Remote Connections window will be opened. In this window, select the IIS Machine and the click on Select button.


5. Wait until the connection is established and the process list is populated. From the process list, find the process associated with your website/web application in IIS. To easily find the process, you can enter w3wp in the search box to filter the process list. After finding the process on the IIS machine, select it and click on Attach.

6. If the Attach Security Warning window is shown, just click on Attach if you are sure to attach to the process.

7. Now, your website/web application on an IIS machine and your Visual Studio are connected to each other. You can now put a breakpoint in Visual Studio and start sending requests to IIS, to see that while processing the request, your breakpoints in Visual Studio are being hit.

Congratulation! you have successfully set up the Remote Debugger. But before you proceed, please note that you should not use this approach on production servers. because as you saw, breakpoints cause your application to be completely halted, and this can harm your application performance and usability. Just use this approach and similar approaches in test or staging environments.



IIS 8 Hosting - HostForLIFE :: ASP.NET MVC Application Deployment on IIS Server

clock June 20, 2023 08:22 by author Peter

Microsoft's Internet Information Services (IIS) is a flexible, general-purpose web server that delivers HTML pages or files requested on Windows computers.


Client workstations located remotely can submit queries to an IIS web server, which will then return the appropriate response. Using this foundational functionality, Web servers can share and distribute data across LANs, such as corporate intranets, and WANs, such as the Internet.

A web server can provide users with information in numerous formats, including HTML-coded static web pages, file downloads and uploads, text documents, and image files.
ASP.Net MVC Application Deployment on IIS Server

Step 1
Using Visual Studio, develop the ASP.net MVC application.

Select the Project Type as MVC and hit the create button.

Now our Project is in the initial Deployment stage.

Now our application is ready for Deployment on IIS Server.


Step 2
Now right click on the application and hit the publish option.

Step 3
Select the deployment options.

We will select the Folder option.


Create the Directory in your system for Application Build.

Select your folder for application build.

Hit the Finish button and we are good to go.


Our application build was created successfully.

Our Deployment Build is ready.

Step 4
Open the IIS Server.


Right click on the websites and add a new website. Give the name of the website and add the physical path for your application where you stored the application build. The next step will be to give the Hostname to your website (Simply the Domain Name)

Deploying Asp.net MVC Application on IIS Server

You can see the setting in the below screenshot.

Now click the OK button.

Step 5
Open the C Drive and find the system 32 Folder. Open the Driver Folder and after that, open the etc. folder and then open the Host File

C:\Windows\System32\drivers\etc

Open the Host file using Notepad.


Now open CMD and find your IP Address.
Set the IP Address and Host name in Host file in the way I am doing below.


 

Now go to IIS Server and browse your website.


Now our application is live on IIS Server.

 



IIS 8 Hosting - HostForLIFE :: Automating Database And Folder Backups On Windows Server

clock September 16, 2022 09:51 by author Peter

It is unnecessary to state the importance of having an automated backup strategy for your servers. Every server administrator has to go through the tiring job of setting up backups which include writing scripts, scheduling tasks, setting up alerts, and so on. To simplify this task, I have designed a simple utility to help server administrators and database administrators automate backups. This utility can automate MSSQL, MySQL, and Folder backups.

You are welcome to suggest new features or contribute your own.
 
Part 1 - Installing the utility

    Download the setup file from the GitHub repository (Installer\bin folder)
    Install on the server where you need to set up backups

After you run the application, you will see the following screen:

Part 2 - Defining Backup Jobs
Click on the 'Settings' button on the bottom right to configure backup jobs.
On the first tab, 'MSSQL Server', click on the 'Add' button to add a new MSSQL backup.
Define the server details as shown below. Check 'Enable Backup' and specify the backup time.

After entering the details, click on 'Validate and Save'. The utility will try to connect with the MSSQL Server using the given credentials. If the connection is successful, the entry will be saved and you will see it in the list as shown below,

Similarly, go to the second tab 'MySQL Server', and click on the 'Add' button to add a MySQL backup.


You can also backup specific server folders by using the 'Folder Backup' tab.

Part 3 - Specifying Local Storage Location
After defining the backup jobs, go to the 'Local Storage' tab and designate a folder on your server where you wish to store the backups.
Be careful that this folder should not be one of the backup folders, otherwise the program may behave unexpectedly.

Since all backups will be stored in this folder, it is recommended to set an auto-delete policy as shown above. You can set a longer duration like 15 days or so as per your convenience.
 
Part 4 - Remote Storage
After backing up files locally on the server itself, we need to move them to remote storage.
 
Currently, the utility supports Amazon S3 backups. Go to the 'Remote Storage' tab and define your AWS credentials to automatically move files from 'Local Storage' to 'Remote Storage'.


 
Part 5 - E-Mail Alerts
You can easily set e-mail alerts to notify you of successful/failed backup jobs (both local and remote backups)
Click on the 'E-Mail Settings' tab and define your SMTP credentials as shown below.

There are four types of alerts available:
    Send mail on failed local backup
    Send mail on failed remote backup
    Send mail on successful local backup
    Send mail on successful remote backup

Click on 'Validate and Save' to check your e-mail credentials. This will send a test mail to the 'Recipient E-Mail' address.
 
Click 'Close' to go back to the main screen.


The number of backups defined will appear here. It will also show the status of AWS S3 settings and E-Mail settings.
Click on the 'Install' button to install a backup service to process your jobs in the background.
This may take a couple of seconds. The status will change, as shown below:


To view logs, click on the 'Logs' button. Here you can find the logs of backup jobs and results for troubleshooting purposes.
After this, you can click on 'Exit' to close the User Interface.
The backup service will keep running in the background and will take care of defined backup jobs.
To verify the backup service status, open 'services.msc' and check for service name 'Runtime Backup Service'


Here is a sample e-mail sent by the utility:

 

I hope this will help your business and save you lots of time in managing multiple backup scripts and configuring alerts.
 
Using this unified interface, you can automate your backup jobs easily.



IIS 8 Hosting - HostForLIFE :: How To Change Localhost To Custom Domain Name In IIS?

clock September 9, 2022 08:55 by author Peter

Most developers face a lot of problems while releasing a website in the production/hosting environment because they don't have experience with local IIS and custom domain names. IIS Express (localhost) provides developers with almost all the settings for development and debugging. Since most of the developers work with IIS Express, they have a lot of issues while working on the real server (hosting environment).


Instead of running, developing, and debugging (testing) a website using a localhost URL (like http://localhost:), local IIS (custom domain name) gives a good feel and looks professional. Setting a custom domain name instead of localhost will help you during website development, debugging, and its release.

Often, developers release security patches and updates to their customers. For this, they require the versioning of the domain. The virtual directory and application concept in IIS (Internet Information Services) helps developers to a version that I will also discuss in my article.

In this tutorial, I am going to explain various steps to change localhost to a custom domain name in IIS. This detailed article will cover the following topics as follows,

    Introduction
    Terminologies
    Prerequisites
    IIS Setup Configurations
    Changing localhost to Custom Domain Name Configurations
    Advanced Custom Domain Name Configurations
    Conclusion

Terminologies
As per Wikipedia, "Internet Information Services (IIS, formerly Internet Information Server) is an extensible web server software created by Microsoft for use with the Windows NT family. IIS supports HTTP, HTTP/2, HTTPS, FTP, FTPS, SMTP and NNTP".

Application Pool
An application pool defines a group of one or more worker processes, configured with common settings that serve requests to one or more applications that are assigned to that application pool. Since application pools allow a set of web apps to share one or more similarly configured worker processes, they provide an easy way to isolate a group of web applications from other web applications on the server machine.

With the help of application pools, we can achieve the level of application isolation required in terms of availability and security by deploying applications across multiple application pools. Each worker process is separated by process boundaries. Therefore, problems with applications in one application pool have no effect on sites or applications in other application pools. Application pools significantly increase the dependability and management of your web infrastructure.

Site
A site is a container for applications and virtual directories that can be accessed through one or more unique bindings. Binding has two major communication properties:

    Binding Protocol: It defines the protocol over which communication between the server and the client occurs. It can be either HTTP or HTTPS.
    Binding Information: It defines the information that is used to access the site. It is the combination of IP address, port, and optional host header.

If a site requires different protocols or binding information, it may have more than one binding.

Note
In earlier versions of IIS, only the HTTP and HTTPS protocols were supported, but in IIS 7 and above, bindings can apply to any protocol.

Application
An application is a set of files that delivers content or provides services over a protocol, such as HTTP. When you create an application in IIS, the path to the application becomes part of the URL of the site.

Virtual Directory
A virtual directory is a directory name (also called a path) that you specify in IIS and mapped to a physical/virtual directory on the system.

Note
Virtual Directories aren't supported with ASP.NET Core apps. An ASP.NET Core app can be hosted as an IIS sub-application.

In short, a site can contain more than one application or virtual directory, an application can contain more than one application or virtual directory, and a virtual directory can contain more than one application.

Prerequisites

    IIS (Internet Information Services)
    Running Project (Here, I am using an ASP.NET web application).
    Web Browser (Whatever you use, but I like Microsoft Edge)

IIS (Internet Information Services) Setup Configurations

This section will tell you how to set up IIS (Internet Information Services) in your system. First of all, we have to check whether our system has IIS enabled or not? For this open any of your favorite browsers and just type the following URL, "IIS Windows".

If you get this page, it means that you have already enabled IIS in your system. So, you can skip this section and go to the next section.

If you get this error, it means you need to enable it. So, stay with us and follow the steps given below very carefully. (Make sure you are connected to the Internet when configuring it).

Note
You can also check if you have IIS enabled on your system by searching for "IIS" in your Universal Search, which is next to the Start button.

Step 1
Click Start and type "Turn Windows features on or off" in the search bar. Then, click Turn Windows features on or off to open Windows Features.

Step 2
Search for "Internet Information Services" and check it and every box that appears in it needs to be checked. Click on the "OK" button to proceed.

Note
Make sure you have checked every box inside it. Because if some features are left, it will cause problems in IIS while mapping your application.

Step 3

After successful installation, a message will appear on the screen "Windows completed the requested changes". Now, click Close. (Now, you have to restart your system to apply all the changes).

After the system restarts, search for IIS again in your Universal Search Bar near the Start button. You will see the IIS as a result. Now, click on, to open it. (Alternatively, you can confirm it by typing the following URL, IIS Windows in any of your favorite browsers).

Congratulations, you have successfully enabled IIS in your system.

Changing Localhost to Custom Domain Name Configurations
Step 1
Click Start and type "IIS". Then click "Internet Information Services (IIS) Manager" to open the Internet Information Services (IIS) Manager.

Step 2
First, we create a new application pool to host our new application. Follow steps 2a and 2b very carefully to create a new application pool.

Step 2a
Right-click on the Application Pools, and click on "Add Application Pool...".

Step 2b
Now, create a new application pool by choosing the following configurations. (Note, if you are using the latest version of the .NET framework, select the following options).
    Give a name to your new application pool
    Select ".NET CLR Version v4.0.30319" option from .NET CLR Version
    Select the "Integrated" option from Managed pipeline mode

Step 3
Right-click on the Sites and select the "Add Website..." option from the list.

Step 4
Now, enter the details as per the given fields and your requirements. And, click the "OK" button.

    Site Name: Choose a name for your new website.
    Application pool: Select the "Application pool" that you have created earlier, by clicking on the "Select" option.
    Physical path: Select the main (root) directory of the application.
    Host name: Now, it's time to set up your custom domain name. In the "Host name" field, type the custom domain name you want for your application.

Note
If you do not select the Application Pool, a new application pool is created using the name of the site when the site is added. IIS defaults to one application pool per site.

Step 5It's time to register/map your custom domain name with your local IP (127.0.0.1). To do this, navigate to the following path, "C:\Windows\System32\drivers\etc" and open the "hosts" file in any text editor with the Administrator privileges. Remember that, you will need administrator privileges to save your changes in the "hosts" file.

This is a sample HOSTS file used by Microsoft TCP/IP for Windows. This file contains the mappings of IP addresses to host names. Each entry should be kept on an individual line. The IP address should be placed in the first column followed by the corresponding host name. The IP address and the host name should be separated by at least one space. Additionally, comments may be inserted on individual lines or following the machine name denoted by a '#' symbol.

For example:

  • 102.54.94.97     rhino.acme.com      # source server
  • 38.25.63.10       x.acme.com           # x client host

Now, map your custom domain name as in the following example and save the file.


 

Congratulations, you have successfully changed localhost to the custom domain name for your application.



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)

 



IIS 8.0 Hosting UK - HostForLIFE.eu :: How to Fix Troubleshoot HTTP 400 Bad Request error on IIS ?

clock November 8, 2019 10:25 by author Peter

There's a J2EE app running on the Tomcat with ISAPI redirector on IIS 8 of Windows Server 2012. Recently the customer got the error related to an AJAX request. At the point when debugging the issue, I figured out that the IIS returns HTTP 400 Bad Request error instead of passing along the url for the Tomcat to handle it.In the IIS log record, there's no record for this appeal nor lapse log not one or the other.

Go to the IIS admin:
Website > Advanced Settings > Limits > Maximum URL Segments: 32
Request Filtering module > Edit Feature Settings:
Maximum URL Length: 4096
Maximum query string: 2048

All is well. The url that makes blunder meets those design since it has recently few segments and the length is around 380 characters - a long ways behind the utmost settings. At that point I attempted to shorten the url a little bit and then a little bit.. and then finally it worked. It seems there's a limit around 300 characters.

Google around to to enable the error log and I found How to troubleshoot HTTP 400 errors. At that point go to  Error logging in HTTP APIs. Download the Enable HTTP API lapse logging  Microsoft Fix it 50634 to introduce it, yet it said the current OS is not matched! In spite of the fact that the direction applies for Windows Server 2012 Standard as the application is running on.
So have to go to regedit and configure the Http.sys registry settings with following parameters:
EnableErrorLogging: Decimal 1
ErrorLogFileTruncateSize: Decimal 10 (MB)
ErrorLoggingDir: C:\inetpub\logs\LogFiles

Then do : net stop HTTP
It will asks you to confirm another services also:
   Windows Remote Management (WS-Management)
   Windows Event Collector
   World Wide Web Publishing Service


Then do: net start HTTP
The HTTP Service service was started successfully.
Check the website, it will stop. Start HTTP again, but it said the HTTP service is already started!
So go to the services manager to start World Wide Web Publishing Service, then Windows Remote Management (WS-Management) and Windows Event Collector

Then test again and see the error log file with a record just shows a very simple error reason: URL. There's a breaking point setting called UrlSegmentMaxLength with 260 characters of course! I felt that brought about the issue in light of the fact that the full url with space name that worked when there's around 300 characters.  So go to regedit and add UrlSegmentMaxLength with 1000 characters value to the HTTP parameters and restart http, w3svc, winrm and wecsvc services again.

I ask why the MS didn't make it for an every particular site like the Maximum URL Segments and effectively to set. In any case we'll need to arrange in the Windows registry that requires to restart entire administrations and influence all sites.

HostForLIFE.eu IIS 8.0 Hosting
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 customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.



IIS 8 Hosting Germany - HostForLIFE.eu :: WordPress on Windows Server 2012 with IIS 8 and SQL Server 2012

clock October 18, 2019 11:09 by author Peter

Yesterday I decided to install WordPress for my new blog, both because it seemed like good product for the job and also to get some experience in running it (and thus also PHP) on Windows Server 2012 with IIS 8 Hosting. There are some good resources scattered around the web, but none seemed up to date, so I decided to share my notes from the install on here. I’m assuming you already have Windows Server 2012 and SQL Server 2012 installed.

IIS 8 CONFIGURATION
The configuration of IIS 8 is quite easy: you just enable the Web Server role through Server Manager. Just to be complete, the screenshot below shows the options I currently have installed, but keep in mind that I’m also running ASP.NET on my server.

Yesterday I decided to install WordPress for my new blog, both because it seemed like good product for the job and also to get some experience in running it (and thus also PHP) on Windows Server 2012 with IIS 8. There are some good resources scattered around the web, but none seemed up to date, so I decided to share my notes from the install on here. I’m assuming you already have Windows Server 2012 and SQL Server 2012 installed.

IIS 8 CONFIGURATION
The configuration of IIS 8 is quite easy: you just enable the Web Server role through Server Manager. Just to be complete, the screenshot below shows the options I currently have installed, but keep in mind that I’m also running ASP.NET on my server.I also highly recommend you install PHP Manager (http://phpmanager.codeplex.com/) as it will help us in enabling/disabling PHP extensions from within IIS Manager later on and provides an easy way to access php.ini as well.

PREREQUISITE INSTALLATION
To make things easy, you can install and configure PHP quite easily using the Microsoft Web Platform Installer. When you run the Web Platform Installer (Web PI), you can do a quick search for “sql php” and it comes up a few results. When you select “Microsoft Drivers 3.0 for PHP v5.4 for SQL Server in IIS”, which is what we need, all other prerequisites will be automatically installed as well as dependencies (PHP and URL Rewrite for IIS).

After Web PI finishes, you will have PHP installed and configured for use in IIS. Time to do a little test to see if everything is running smoothly. Create a new file under C:\inetpub\wwwroot\ (or wherever your Default Web Site is pointing to) named test.php with the following content:
<?php echo phpinfo(); ?>

This will output information about your PHP configuration.

Time to try it out: navigate to the page (likely http://localhost/test.php). If you are greeted with a screen with purple blocks of information about your PHP configuration, you’re all set and you can skip ahead to the WORDPRESS INSTALLATION section. Chances are you’re going to be greeted with an IIS 403.1 error screen, however, which is due to the fact that the user account that IIS is currently using for the anonymous access to your site doesn’t have the proper privileges to access your wwwroot (or equivalent) folder on disk. This is solved quite easily by granting this user (called IUSR by default) access to the wwwroot folder through Windows Explorer or your other favorite method.

Retry and bask in the glory of the phpinfo() output.

WORDPRESS INSTALLATION

Now we can start downloading the actual WordPress files and start the installation. First off, grab the latest version (or the version of your choice) of WordPress. We will also need the WP Db Abstraction plugin. After downloading, unblock and unZIP both files in a folder under wwwroot (or your Web Site’s location). Installation of the WP Db Abstraction plugin is quite easy, just follow the steps outlined in the readme.txt:Upload wp-db-abstraction.php and the wp-db-abstraction directory to wp-content/mu-plugins. This should be parallel to your regular plugins directory. If the mu-plugins directory does not exist, you must create it.

Put the db.php file from inside the wp-db-abstraction.php directory to wp-content/db.php
Visit $your_wordpress_url/wp-content/mu-plugins/wp-db-abstraction/setup-config.php to generate your wp-config.php file

Before you perform the last step, though, go to IIS Manager and enter PHP Manager (it’s located on the Features page of your server under IIS). Scroll down and click the “Enable or disable an extension” link. You need to make sure that php_pdo_sqlsrv.dll and php_sqlsrv.dll are both enabled. You can also go ahead and disable the *mysql*.dll extensions. Here’s my list of enabled extensions:

Now we can visit the setup-config.php page as outlined above. The steps here are quite straightforward, so I’m not going to walk you through them. You will need to create a user on your SQL Server 2012 installation with SQL Server authentication that has access to a database that you also need to create to use for your WordPress installation.

One note about this process: I had some issues when choosing the default selected “SQL Server using MS PHP driver” and went with the “PDO SqlSrv” option the second time to eliminate these issues.

If the wizard has trouble automatically creating the wp-config.php file, you can either choose to give IUSR write permissions on the folder you created to hold all your WordPress files or you can manually create the file under that folder and paste the output you see on screen in there (I chose the latter). After the wp-config.php file is created, you can start the installation of WordPress by clicking the link on the bottom of the page you’re on.

WORDPRESS CONFIGURATION

After the install, which should only take a minute tops, you are now ready to log in to your WordPress admin dashboard and start configuring it how you’d like. As you can see, there’s a sample post and comment already waiting for you. If your experience is anything like mine, you will notice that when you navigate to the Posts -> All Posts option on the top left of your dashboard you won’t actually see these posts in the list. It took some hunting around the web to figure this out, but apparently there’s a line in the translations.php file of the WP Db Abstraction plugin that’s causing this (thanks to tm3ister on http://sourceforge.net/projects/wp-sqlsrv/forums/forum/1124403/topic/5004241 for figuring this out!). The solution is to manually edit the translate_limit function in the mu-plugins/wp-db-abstraction/translations/sqlsrv/translations.php file:

Change

// Check for true offset
if ( (count($limit_matches) == 5  )  && $limit_matches[1] != '0' ) {
    $true_offset = true;
} elseif ( (count($limit_matches) == 5 )  && $limit_matches[1] == '0' ) {
    $limit_matches[1] = $limit_matches[4];
}

To

// Check for true offset
if ( (count($limit_matches) == 5  )  && $limit_matches[1] != '0' ) {
    $true_offset = true;
} elseif ( (count($limit_matches) >= 5 )  && $limit_matches[1] == '0' ) {
    $limit_matches[1] = $limit_matches[4];
}

And voila, your posts will now show up.

The last thing we’re going to configure is Permalinks (or pretty URLs) for our posts. When you navigate to Settings -> Permalinks on the admin dashboard, you’ll see some options to rewrite URLs to be more human and search engine friendly. For now, select Custom Structure and enter /%year%/%monthnum%/%postname%/ in the text field and hit Save Changes. The last step is to create a web.config file in our WordPress folder to rewrite the URLs according to this scheme with IIS URL Rewrite. Create a new web.config file (if you don’t have one already) in the folder you installed WordPress to and copy in the following:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="wordpress" patternSyntax="Wildcard">
          <match url="*" />
          <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
          </conditions>
          <action type="Rewrite" url="index.php"/>
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

You’re now all set to use WordPress on Windows Server 2012 with IIS 8 and SQL Server 2012!



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