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 8.0 Hosting UK - HostForLIFE.eu :: Error Message 401.2: Unauthorized - Logon Failed Due To Server Configuration

clock March 7, 2024 06:40 by author Peter

Sometimes we receive this error message after publishing the solution in IIS. This mistake is very common.


Exact Error
Error message 401.2: Unauthorized The login failed due to server configuration. Check that you have authorization to browse this directory or page using the credentials you provided and the authentication methods enabled on the Web server. For further assistance, contact the web server administrator.

This problem is mostly caused by IIS's authentication settings.

Solution
Launch the IIS.

Choose the site where you are experiencing the problem.
Select Authentication. Setting as indicated.


Authentication choices can be updated based on your application's requirements.

In my case, the application needs to set windows authentication, therefore, I set it to enabled and Anonymous Authentication Disabled.



IIS 8.0 Hosting UK - HostForLIFE.eu :: Protect Static Files In ASP.NET Web Forms With The Help Of HTTP Handle

clock February 27, 2024 08:03 by author Peter

First, let me explain the problem I encountered in the web forms application (ASPX). I have a legacy web application that was created in ASP.NET and deployed on IIS 10. Static files (PDF, JS, CSS, JSON, and all forms of pictures (jpg, png, BMP, etc.)) are stored in a subfolder on the site called data, such as http://example.com/data/...When an unauthenticated person browses the files.

e.g.

http://example.com/data/image.gif or http://example.com/data/sample.css or http://example.com/data/sample.js).
It will display the files without authentication. In other words, the pages should only be accessible once the user is authorized.

IIS Default Behavior By default, the IIS web server routes ASP.NET resource requests to the ASP.NET runtime, but it handles static content requests directly. As a result, requests for static content are served without consideration for the URL authorization requirements specified in the ASP.NET application settings.

When I try to browse this issues regarding the same in internet , there are lot of things like enabling runAllManagedModulesForAllRequests="true" but nothings works out. Even though I am running my application in integrated mode in IIS.

Then I came to know about HTTPHandler. Below is the definition of HTTP Handler from Microsoft.

HTTP modules and HTTP handlers are an integral part of the ASP.NET architecture. While a request is being processed, each request is processed by multiple HTTP modules (for example, the authentication module and the session module) and is then processed by a single HTTP handler. After the handler has processed the request, the request flows back through the HTTP modules.

HTTPHandlers are used by ASP.NET web application server to handle specific requests based on extensions. HTTPHandlers run as processes in response to a request made to the ASP.NET website. It is a class that implements the System.
How to implement HTTPHandler to handle any incoming HTTP request with a path like .gif/.js/.css?

  • Create a class file — it could be FileProtectionHandler.cs
  • Let FileProtectionHandler class inherit from IhttpHandler Interface.
  • In FileProtectionHandler class, implement all the methods which are found in IhttpHandler Interface.

When a request comes, it will check whether it will be authenticated or not, if not it will redirect to login page otherwise will send the requested file based on the file extension.
using System;
using System.IO;
using System.Web;
namespace Example.UI {
    public class FileProtectionHandler: IHttpHandler {
        /// <summary>
        /// You will need to configure this handler in the Web.config file of your
        /// web and register it with IIS before being able to use it. For more information
        /// see the following link: https://go.microsoft.com/?linkid=8101007
        /// </summary>
        #region IHttpHandler Members
        public bool IsReusable {
            // Return false in case your Managed Handler cannot be reused for another request.
            // Usually this would be false in case you have some state information preserved per request.
            get {
                return true;
            }
        }
        public void ProcessRequest(HttpContext context) {
            //write your handler implementation here.
            if (!context.User.Identity.IsAuthenticated) {
                context.Response.Redirect("~/Login.aspx");
                return;
            } else {
                string requestedFile = context.Server.MapPath(context.Request.FilePath);
                SendContentTypeAndFile(context, requestedFile);
            }
        }
        private HttpContext SendContentTypeAndFile(HttpContext context, string strFile) {
            context.Response.ContentType = GetContentType(strFile);
            context.Response.TransmitFile(strFile);
            context.Response.End();
            return context;
        }
        private string GetContentType(string fileName) {
            string res = null;
            FileInfo fileInfo = new FileInfo(fileName);
            if (fileInfo.Exists) {
                switch (fileInfo.Extension.Remove(0, 1).ToLower()) {
                    case "pdf": {
                        res = "application/pdf";
                        break;
                    }
                    case "gif": {
                        res = "image/gif";
                        break;
                    }
                }
            }
            return res;
        }
        #endregion
    }
}

The next step is to register the HTTP handler in the Web.config file. Based on your IIS version, it should be added as a child of <system.web> or <system.webServer>. Refer here to register
<httpHandlers>
    <add path="*.gif" verb="*" type="MyProject.FileProtectionHandler" validate="false" />
    <add path="*.png" verb="*" type="MyProject.FileProtectionHandler" validate="false" />
    <add path="*.jpg" verb="*" type="MyProject.FileProtectionHandler" validate="false" />
    <add path="*.js" verb="*" type="MyProject.FileProtectionHandler" validate="false" />
    <add path="*.svg" verb="*" type="MyProject.FileProtectionHandler" validate="false" />
    <add path="*.bmp" verb="*" type="MyProject.FileProtectionHandler" validate="false" />
    <add path="*.json" verb="*" type="MyProject.FileProtectionHandler" validate="false" />
    <add path="*.css" verb="*" type="MyProject.FileProtectionHandler" validate="false" />
</httpHandlers>


That’s all. Now HTTP Handler is ready
Once this configuration information has been specified in Web.config revisit the image file hosted via IIS from your browser. This time while processing the request for the image file IIS allows for the ASP.NET runtime to perform authentication and authorization logic. The ASP.NET runtime notes that the request is coming from an anonymous user and is for a URL that denies anonymous users. Therefore, the anonymous user is redirected to the login page, just like when visiting the image file served by the ASP.NET Development Server.



IIS 8.0 Hosting UK - HostForLIFE.eu :: Recognizing and Handling.Net Server-Side (Output) Caching

clock January 29, 2024 07:41 by author Peter

A user's request does not go to the database every time they visit a website in order to answer every detail. As an alternative, some data is extracted directly, which speeds up and improves efficiency. This tactic enables the server to process numerous requests from various users without interfering with the database. Important information is stored in the server's memory so that it can respond to your request promptly.


Given that data is typically saved in databases, you may be asking how the server obtains, stores, and locates this data.

Thus, the Internet Information Services, or IIS, serves as the operation's beating heart.

Output Caching is the name of the operation.


Even the type of file and duration of storage are customizable. by using the easy steps listed below.

  • On your server, open the Internet Information Services (IIS) Manager.
  • Access your web application by navigating through the Connections pane.
  • Give the "Output Caching" feature a double-click.
  • Examine the cached items, their expiration dates, and other pertinent details in the "Output Caching" feature.

But how can the cache be kept there?
Installing System is hence the first step.Net.Caching from the Nuget bundle

Caching in System.Web
You can implement caching within a server-side web application, usually hosted by Internet Information Services (IIS), by using the classes provided by the System.Web.Caching namespace. The caching method uses the server's RAM to cache data when you use the System.Web.Caching namespace in an ASP.NET web application hosted on Internet Information Services (IIS).

Create
HttpRuntime.Cache.Insert("yourkey","your value");To do CRUD activities with such caches, there are a few methods under this namespace.

This is how the cache is set. You might have noticed, though, that the code above doesn't indicate when this caching item expires. This suggests that unless the web application is terminated or restarted, the caching item won't be destroyed. As a result, you must also include an expiration.

Here's another method to get there:

HttpRuntime.Cache.Insert(
     string key,
     object value,
     System.Web.Caching.CacheDependency dependencies,
     DateTime absoluteExpiration,
     TimeSpan slidingExpiration
);

You are aware of the value and key in this case, but what about the other parameters?

Dependencies: When any of a cache item's dependencies are altered or eliminated, the cache item will be automatically cleared.

Nonetheless, if you would like it to stay in the cache until further specified expiration conditions (such absolute or sliding expiration) are satisfied or until it is manually deleted.

Absolute Expiration: The cache can have a precise expiration time that you specify. To set its value, there are three options:

  • Absolute Time of Expiration: AbsoluteTime belongs to the DateTime type. You designate a precise day and time for the cache item to expire. The cache expires when this date and time are reached.
  • Save.NoAbsoluteExpiration: This constant value means that the item will stay in the cache until it is manually removed, and it does not have an absolute expiration period.
  • Blending using Adaptive Expiration:  The slidingExpiration parameter needs to be set to NoSlidingExpiration if you are utilizing absolute expiration.

Declining Expiration
1. Sliding Expiration makes sure that the cache item lifespan will be increased by the interval value if the data is accessed within the designated time frame. For instance, a session with a 10-minute expiration is introduced.
TimeSpan.FromMinutes(5), TimeSpan.FromSeconds(30), NoSlidingExpiration, etc. are few examples.

2. Combining with AbsoluteExpiration: NoAbsoluteExpiration is required as the absolute expiration argument if sliding expiration is being used.



IIS 8.0 Hosting UK - HostForLIFE.eu :: IIS Website Debugging Using Visual Studio

clock January 15, 2024 06:43 by author Peter

Start Visual Studio: Open the Visual Studio project or solution that is associated with your IIS website.

Configure IIS: Verify that your IIS website is set up and operational. If not, set it up by making a fresh website or utilizing an already-existing one.
Build Configuration: Verify that the configuration for your project contains debugging details. Usually, the "Debug" setting would be utilized.
Begin debugging: Click on the "Start Debugging" button in Visual Studio (or press `F5`). This will connect the debugger and start your application.
Attach to Process: To attach the debugger to an already-running IIS website, go to the "Debug" menu, pick "Attach to Process," and select the process that corresponds to your IIS application pool (in most cases, `w3wp.exe} for IIS worker processes).
Choose the Appropriate Code: Verify that the source code you wish to debug is the same one that IIS is using. Make sure the right project and build configuration are chosen by checking the configuration of the solution.
Establish Breakpoints: Whenever you want the debugger to pause so you may walk through the code and examine variables, place breakpoints in your code.
Debugging: You can now debug your IIS website once it has been attached. At the breakpoints, Visual Studio will pause, allowing you to step through code, examine variables, and troubleshoot problems with the debugging tools.

Keep in mind that in order to attach the debugger to the IIS process and adjust the IIS application pool settings appropriately, you should have the required permissions for efficient debugging.

You should be able to connect the Visual Studio debugger to your IIS website in order to debug it by following these instructions.



IIS 8.0 Hosting UK - HostForLIFE.eu :: How To Remove IIS On Windows Server 2012

clock November 17, 2023 08:07 by author Peter

Today's article will teach you how to uninstall Internet Information Services 8 (IIS8) from Windows Server 2012.


Step 1
To begin, enter your password into your Windows Server 2012 as Administrator. If your Server Manager does not launch automatically after logging in, open it by clicking the first button in the task bar.

When you launch the Server Manager, the following window will appear:

Step 2
On the Server manager you will see that IIS is already installed.

To remove the IIS go to the Manage option on the upper right hand corner and click on "Remove Rolls and Features".

Step 3
Now a Window will be opened that will inform you that you are going to removing the section. Just click on "Next" to proceed.

After that you must select a Server from the Server Pool. Since I have only one Server in this article, my default Server is Automatically selected.


Step 4
Once you click Next you will get a list (Rolls) from which click on the Web Server (IIS).

Now click "Next", then one more Window will open that will ask for permission to remove the features.

Step 5
You can select the features that are associated with IIS to be removed.

After clicking Next you must give permission to restart the server automatically if it's considered necessary, then click on "Next".

Step 6
Click on the "Remove" button and the process will begin.


When the removal process is complete, your Windows Server 2012 will be restarted because you already granted permission to do so.

Step 7
After restarting it will automatically show that the removal process had completed successfully.

You can also check this on the Flag that is present on the above right hand corner. Click on the Flag and following confirmation will be shown,



IIS 8.0 Hosting Germany - HostForLIFE.eu :: How to Use LogParser to Check Visitor IPs to a Certain Page?

clock February 21, 2020 10:50 by author Peter

Today I noticed we were getting an expanding measure of spam on one of our sform pages. I was interested to check whether the majority of the client IP locations were the same (in which case I'd simply add them to the IIS IP Restrictions list). To rapidly and effortlessly make sense of this I chose to utilize LogParser.

Other than simply questioning for the page however, I needed to add an extra condition to prohibit lines that originated from a certain  internal IP address that we use for checking.

Here’s a generic version of the query I used:
LogParser.exe -q:on "SELECT * FROM x:\wwwlogs\W3SVC1\u_ex130411.log WHERE cs-uri-stem='/SomePage/' and c-ip<>'10.10.1.100' >c:\temp\PageVisitors.txt"

I needed to see the full logged information for the request, but if I didn’t, I could have very easily just pulled the IP addresses using:
LogParser.exe -q:on "SELECT c-ip FROM x:\wwwlogs\W3SVC1\u_ex130411.log WHERE cs-uri-stem='/SomePage/' and c-ip<>'10.10.1.100' >c:\temp\PageVisitors.txt"

You can see that I'm funneling the outcomes to a content record (the ">c:\temp\PageVisitors.txt" part) so I can without much of a stretch manage the outcomes. You might likewise need to observe that I'm utilizing the "-q:on" flag which runs the command in Quite Mode. In the event that you don't set this banner then LogParser will show comes about one page at once. At the point when funneling to a content record as opposed to the summon prompt window, you clearly can't hit a key for "next page" so without this banner the question will really hang forever if there is more than one page worth of results.

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.0 Hosting - HostForLIFE.eu :: Enable Other Protocols (TCP, PIPE, MSMQ etc.) In IIS

clock February 7, 2020 11:18 by author Peter

By default it's available only in HTTP, HTTPS and FTP protocols Windows IIS though it supports others like TCP, PIPE protocols as well.

This blog demonstrates how to enable other protocols like TCP in IIS. Getting started, we know that Windows IIS by default supports only HTTP, HTTPS and FTP protocols and you will get those protocols in the binding window of IIS.

But other protocols like TCP, PIPE etc. Can be enabled by changing IIS feature, the below steps defines how to tune IIS features to enable TCP protocols.

Follow the Steps
     Open Control Panel=>Programs=>Click on Uninstall or Change a Program=> Click on Link ‘Turn Windows Features on or off’.

  1. Windows Features window will be opened, expand .NET Framework Advance Service.

  2. Expand WCF Services=>Select All the Features HTTPActivation, Message Queuing (MSMQ) Activation, Named Pipe Activation, TCPActivation, TCP Port Sharing .Click OK button.

Windows will apply the changes you made and you will get message popup, close the window (Clicking on close button), restart your machine and follow the below steps. Open IIS=> in Connections panel=> expand Sites=>Select your website=>Go to Right site Action Pane=> click on Advanced Settings=> Expand the ‘Behavior’ section In the field ‘Enable Protocols’ set these below values by commas, (http,net.tcp,net.pipe,net.msmq,msmq.formatname). Click OK button.

  • For activating TCP protocol set ‘net.tcp’
  • For activating PIPE protocol set ‘net.pipe’
  • For activating MSMQ Protocol set’ net.msmq’

Now you are done, if you follow the above steps correctly, you will get the mentioned protocols in the binding window.



IIS 8.0 Hosting - HostForLIFE.eu :: PUT , POST & DELETE Verbs Not Allowed in IIS 8

clock January 31, 2020 11:42 by author Peter

Today, I will write about PUT, POST and DELETE verbs on the web application in IIS. And this is the error:

<h2>405 - HTTP verb used to access this page is not allowed.</h2>
<h3>The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access


After some troubleshooting the error was isolated to the actual fact that WebDav was put in on the server and was intercepting those requests for its own service use.
Rather than removing WebDav from the server, we tend to went searching for another answer. thankfully somebody on Twitter understood the problem and gave an example of changes to create to the client’s web.config get in order to disable (remove) the WebDav module for simply that specific website while not requiring any manual body actions on the server.

The code updates to create to your web.config file to resolve this error are:
<configuration>
  <system.webServer>
    <handlers>
      <remove name="WebDAV" />
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
    <modules>
      <remove name="WebDAVModule" />
    </modules>
  </system.webServer>
</configuration>

I hope this tutorial works for you!

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