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

European IIS 7 Hosting - HostForLIFE.eu :: How to Easily Create Multiple 301 Redirects with a URL Rewrite Map

clock November 6, 2014 08:33 by author Frank

Redesigning a website or creating a new version of an existing web page is a common task for web developers and webmasters. If you have an established web site with good search engine traffic it’s critical to be able to redirect that search traffic from the old pages to the new pages even if the name of the page or the page location changes. Even if that content is great and plenty of people have linked to your page/s, all your hard work won’t matter if search engines like Google are unaware of the new location or people are trying to link to the old, non-existent, page location.

The way to properly communicate these changes to search engines is to use a 301 Redirect which tells search engines the new permanent location of the content.

Using 301 redirects used to be a manual process where you had to place code in the old page using Javascript in the page body or add a special metatag like this:

<meta http-equiv=”refresh” content=”0;url=http://www.domain.com/newpage.html”>

As you can imagine, this can be a tedious and time consuming task if you have several of pages to update. One additional downside to the old manual redirects option is performance. The old page still has to be accessed in order for the redirection to take effect.

URL Rewrite Module with IIS7

Now there’s an easier solution, and one that offers better performance.  Starting with IIS 7 one can implement different kinds of url rewriting and redirecting with ease by using the URL Rewrite Module. The various rules can be configured using the IIS 7 Manager GUI or by directly editing the web.config. To open the URL Rewrite Module simply double click the URL Rewrite icon on your site properties as shown below.


From there you will be able to maintain your existing rules or add new ones as seen in this picture.

 

This is a pretty easy way to create server-side rules for rewriting and redirecting, but what happens when you have 30 or 40 legacy URLs that need to be redirected to new pages? Do you have to enter each one manually? Of course not. The solution to that is to use a URL Rewrite Map.

URL Rewrite MAP

By using a URL Rewrite Map it has never been easier to create and maintain multiple 301 redirects for different pages on your web site.  The rewrite rules are stored in the <system.webServer> section of your web.config so you can quickly make changes as needed.

Here is all the code you need to accomplish this:

<system.webServer>
  <rewrite>
<rewriteMaps>
  <rewriteMap name=”Redirects”>
<add key=”/test.aspx” value=”/test2.aspx” />
<add key=”/aboutus.aspx” value=”/about” />
  </rewriteMap>
</rewriteMaps>
  <rules>
<rule name=”Redirect rule1 for Redirects”>
  <match url=”.*” />
  <conditions>
<add input=”{Redirects:{REQUEST_URI}}” pattern=”(.+)” />
  </conditions>
  <action type=”Redirect” url=”{C:1}” appendQueryString=”false” />
</rule>
  </rules>
</rewrite>
</system.webServer>

In the example above I’m performing a 301 redirect on the test.aspx file to test2.aspx file. There’s also a 301 redirect for the aboutus.aspx file to folder called /about, however, in this case it’s important to note that the /about folder will also need a default page or else a 404 error will result.

As you add more URLs to your Rewrite Map you’ll notice that your web.config can become a bit cluttered. The solution to this will be to store the redirect rules in an external file. Let’s call this file myrewritemaps.config. This file will now contain this code block:

<rewriteMaps>
  <rewriteMap name=”Redirects”>
<add key=”/test.aspx” value=”/test2.aspx” />
<add key=”/aboutus.aspx” value=”/about” />
  </rewriteMap>
 </rewriteMaps>

In your web.config you add the following line of code under the <rewrite> section referencing the external config file:

<rewriteMaps configSource=”myrewritemaps.config” />

Your web.config will now look nice and clean like this:

<system.webServer>
  <rewrite>
<rewriteMaps configSource=”myrewritemaps.config” />  
<rules>
  <rule name=”Redirect rule1 for Redirects”>
<match url=”.*” />
<conditions>
  <add input=”{Redirects:{REQUEST_URI}}” pattern=”(.+)” />
</conditions>
<action type=”Redirect” url=”{C:1}” appendQueryString=”false” />
  </rule>
</rules>  

  </rewrite>
</system.webServer>

Here is a 3rd party site which offers a free test to ensure your 301 redirect rules are working:

http://www.ragepank.com/redirect-check/

There is no real limit on how many URLs can be configured for redirecting with the URL Rewrite Map.  You should perform regular search engine analysis to see when the new URLs have been picked up. Once the old URL is no longer indexed and traffic has dropped off you could remove it from your map.



IIS 8.0 Hosting Netherlands - HostForLIFE.eu :: How To Fix IIS Error 500 Internal Server Error Errors ?

clock November 5, 2014 06:30 by author Peter

Problem:
This is another common error that troubles plenty of ASP.NET users. Generally, the questions are framed like: “This error (HTTP 500 Internal Server Error) means that the website you are visiting had a server problem which prevented the webpage from displaying”
Or you can see on the picture below:

What is a 500 Internal Server Error?

In short, a HTTP 500 error implies that there's a drag with the configuration of the server. An HTTP 500 error isn't a problem the end user will solve themselves.  In their case, they need to report the matter to the server administrator or web site owner. however if you're managing your own IIS server and it’s your job to diagnose 500 server errors, there are many ways that to create the method easier.

Why am I getting HTTP 500 Internal Server Error IIS error?

The HTTP 500 Internal Server Error Iis error is also caused by windows system files harm. The corrupted system files entries may be a true threat to the well being of your PC.
There may be several events which can have resulted within the system files errors. an incomplete installation, an incomplete uninstall, improper deletion of applications or hardware. It also can be caused if your PC is recovered from a virus or adware/spyware attack or by an improper closedown of the PC. All the above actives could lead to the deletion or corruption of the entries within the windows system files. This corrupted system file can cause the missing and incorrectly joined info and files required for the right operating of the application.

How to Fix “HTTP 500 Internal Server Errors”
1. First, log on as an administrator
2. Then, Click the Start button -> All Programs -> Accessories -> System Tools, and then click System Restore.
3. On new window, choose the "Restore my computer to an earlier time" choice so click Next button.
4. choose the most recent system restore purpose from the "On this list, click a restore point" list, so click Next.
5. Click Next on the confirmation window.
6. Now, Restarts your Computer when the restoration is finished.



European IIS 8.5 Hosting - UK :: How to Install Wordpress on Windows Server 2012

clock November 4, 2014 08:56 by author Scott

In this tutorial, I will show you how to install Wordpress on Windows Server 2012 with IIS 8. Assume that you have your own dedicated server and you want to install Wordpress. If you use shared hosting provider, all can be done via one click installation via your hosting provider Control panel, or you can ask your hosting provider to install Wordpress for you. Now, how about if you own your dedicated server and you want to install Wordpress on server?

Configuration

The configuration of IIS 8 is quite easy: you just enable the Web Server role through Server Manager. Please see the screenshot below

Then, please make sure you install PHP Manager, I would recommend you to use http://phpmanager.codeplex.com/. This is good tool and help you to enable and disable PHP extensions.

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 (ref: http://php.net/manual/en/function.phpinfo.php).

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.

Then, please retry

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];
}

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>

Done!! Your Wordpress is ready on Windows Server 2012.



European Full Trust ASP.NET Hosting - UK :: How to Fix The System.SecurityException error occurs when a SocketTools

clock October 31, 2014 08:27 by author Scott

When you application requires Full Trust permission and your hosting provider provider doesn’t offer Full Trust permission, then your application won’t work. This is an error message that you might find if your hosting provider doesn’t support Full Trust

“The System.SecurityException error occurs when a SocketTools .NET component is used with an ASP.NET application, displaying the error message: The application attempted to perform an operation not allowed by the security policy.”

More Information

This error indicates that the server is not configured for full trust. The SocketTools .NET components require unrestricted access to specific system resources such as the networking subsystem and system registry. To grant full trust to your ASP.NET application, you need to modify the web.config file to include the following:

<location allowOverride="true">
  <system.web>
    <trust level="Full" originUrl=".*"/>
  </system.web>
</location>

Note that setting the code access security level to full trust enables the application to call native code, access system services, open database connections and access the registry and modify files outside of the server’s virtual directory.

If your hosting provider doesn’t provide full trust, then above code won’t work too. So, you need to find hosting provider that support Full Trust.

 



IIS 8 Hosting UK - HostForLIF.eu :: Adding Your FTP Site on IIS 8

clock October 29, 2014 09:37 by author Peter

In this article you'll learn the way to add a new FTP site on IIS 8. Before going through this article make sure that FTP and IIS are installed on your system. If you wish to find out a way to install IIS then you'll go through this article: Installing IIS. Now allow us to see the procedure needed to add a new FTP site on IIS 8.

Step 1. First of all Open the Administrative Tools from the START Menu.

Now within the Administrative Tools, there is several options will be available within the list among that you need to choose the IIS Manager and so double-click on that to open it.

Step 2. Now the IIS Manager Window are going to be opened. On the left hand side you'll see a pane named Connection Pane, within the Connection Pane a Server node are going to be available, you need to expand this Server node and so right-click on your Server name and so choose the option named Add FTP site.

Step 3. A new form are going to be opened. Now you need to give the site information that you just that you aiming to create, 1st give the name for this New site and then give the Physical Path by clicking on the Browse Button. This physical path can verify a folder wherever the Content Directory are going to be created.

After select the Name and Physical Path click on the "Next" button.

Step 4. Next, named as Binding and SSL Settings. You must fill the IP Address. Click on the drop down Button and so choose the IP Address, if you do not have any IP Address then you'll choose an option available named All Unassigned. After providing the IP Address, give the Port number.

Step 5. On an equivalent page Uncheck the start FTP site automatically. In SSL 3 options are going to be available, among these choices I selected  the third option, in alternative words need SSL and then I give the SSL Certificate. After give all that information click on "Next".

Step 6. On the next page Authentication and Authorization is to be provided. On Authentication Permitted if you want to permit all the users then you'll check the "Anonymous" otherwise you'll check the "Basic".

In the Authorization I permit all users authorization to Permitted and Write, you'll provide no matter authorization that satisfies your needs. After providing all the information, click on the "Finish" button to create the site.

Step 7. Now in the Sites you'll see that the new website is available under the IIS Default web site.



IIS 7.5 Hosting - HostForLIFE.eu :: Application Pool Idle Time-out Settings on IIS

clock October 23, 2014 09:48 by author Peter

Whether you host in-house or with a managed Windows hosting provider, if you self-administer a web server it's sensible to understand that by default IIS 7.5 sets application pools to “time-out” when twenty minutes of inactivity. therefore if you don’t have a visitor to your website within twenty minutes the application pool can shut down those system resources. Then the next time a request comes into the site IIS7 can automatically restart the application pool and serve the requested pages.

This is an excellent way to preserve resources since each running application pool will place a certain quantity of overhead on the system. But, it conjointly implies that the primary request – the one that causes the application pool to restart – is incredibly slow. it's slow as a result of the method literally must begin, then load the desired assemblies (like .NET) then load the requested pages. betting on the size and complexity of your application, this would possibly simply be a couple of seconds or it'd take 30+ seconds (during which time a user would possible quit and move on to a different site).

If you wish to increase the length of the time-out setting, simply change it from the default of twenty to however several minutes you wish. you can also modify the setting to zero (zero) which effectively disables the timeout so the application pool can never shut down due to being idle.

To make this change, open Server Manager; Expand the Roles node; Expand the web Server (IIS) node. Then click on the web Server (IIS) node; Expand the node along with your local server name; and click on the application Pools icon. You’ll then see a list of the application pools that are defined on your server. within the right-hand pane you’ll see an option for Advanced Settings -> click that.

Once you see the Advanced Settings dialog box simply look for the Idle Time-out (minutes) property; click wherever the default “20″ is, and change it to no matter value you prefer.

This is only 1 of the many settings that may impact the performance, uptime, and functioning of your web site. If you don’t have the time or interest in learning and maintaining the various settings for a secure high-performing web server, you would possibly need to consider a totally managed windows hosting solution and let a trained and experienced administrator take care of the work for you.



IIS 8.0 Hosting UK - HostForLIFE.eu :: Testing Web Site using SSL on Localhost (IIS)

clock October 22, 2014 06:49 by author Peter

SSL (Secure Socket Layer) is a cryptographic protocol developed by Netscape to supply communications security on the net. cryptographic technology uses 2 keys to encrypt data, one for public (public key) and another for recipient (secret key). SSL enabled websites communicate with a web server employing a security channel (secret key) that prevents tempering, eavesdropping (or merely say hacking). SSL is presumably used for a login section, payment system, on-line banking industry etc that's very sensitive info for a company or person. after we enable SSL for a web site the address can begin with "https://" (indicating hypertext Transfer Protocol Secure) rather than "http://".

To test this, you ought to have IIS installed. there's no need for further software like Visual Studio or any other web site development kit because only one hypertext markup language file can be tested. Follow the steps to enable SSL on Windows Server 2012 operating system; another operational System may have a slight distinction.

1. Open the IIS Manager and choose root computer name -> and double click on "Server Certifications". look at the image given below.

2. Now within the window that seems you'll find "Server Certificates" that are already installed. No problem if another one already exists, I recommend to delete all by choosing each and build a new one. If you're not using your system to host an expert web site then, delete all. Look at the correct panel; you'll find "Create Self-Signed Certificate"; click on it. You'll be prompted to enter the friendly name for SSL and click on OK button.

3. After clicking on the OK button you'll realize a new SSL entry. Currently navigate to "Site List" and right-click on that to choose the "Edit Binding" option. Consider the image given below.

4. When you click on "Edit Binding", you'll get a new window requesting a protocol type. There is also 3 or four items, in my example there's only 1 by default that's "http". No downside if you've got many more. at least one ought to be there. now click on the "Add" button and within the window that appears choose the "Type" to "https" and "SSL Certificate" to "yourSSLname". after you are done, i recommend to delete all other protocol types, only keep https. shut the little window listing protocols at the end.

5. Now everything is configured and enabled for you. Let's take a look at it. Please note I only have the only protocol "https". Since browsers by default use http you've got to use here https while requesting via browser.



European HostForLIFE.eu Proudly Launches PrestaShop 1.6 Hosting

clock October 16, 2014 09:21 by author Peter

HostForLIFE.eu, a leading Windows web hosting provider with innovative technology solutions and a dedicated professional services team, today announced the support for PrestaShop 1.6 Hosting plan due to high demand of PrestaShop 1.6 users in Europe. HostForLIFE.eu hosts its servers in top class data centers that is located in Amsterdam, London and Seattle (US) to guarantee 99.9% network uptime. All data center feature redundancies in network connectivity, power, HVAC, security, and fire suppression. All hosting plans from HostForLIFE.eu include 24×7 support and 30 days money back guarantee.

PrestaShop 1.6 is a free and open-source e-commerce web application, committed to providing the best shopping cart experience for both merchants and customers. It is written in PHP, is highly customizable, supports all the major payment services, is translated in many languages and localized for many countries, is fully responsive (both front- and back-office), etc. PrestaShop 1.6 offers new and improved navigation elements making navigating your online shop easier and more effective than ever.

PrestaShop 1.6 presents a comprehensive, intuitive user administration panel, and gives you hundreds of standard functions that can be adapted or personalized in order to respond to all of customer needs. The front office template on PrestaShop 1.6 is now mobile responsive, allowing customer online shop to display perfectly when accessed from a mobile and tablet device.

At the forefront of the latest innovative web technology, PrestaShop 1.6 integrates with Bootstrap 3.0, FontAwesome, Sass Compass and D3 Data Driven Documents. Online Shopping has never been so technologically brilliant. A unique e-commerce feature you will only find in PrestaShop 1.6, Net Profit Margin is automatically updated in real-time.

Further information and the full range of features PrestaShop 1.6 Hosting can be viewed here http://hostforlife.eu/European-PrestaShop-16-Hosting

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

HostForLIFE.eu is awarded Top No#1 SPOTLIGHT Recommended Hosting Partner by Microsoft (see http://www.microsoft.com/web/hosting/HostingProvider/Details/953). Their service is ranked the highest top #1 spot in several European countries, such as: Germany, Italy, Netherlands, France, Belgium, United Kingdom, Sweden, Finland, Switzerland and other European countries. Besides this award, they have also won several awards from reputable organizations in the hosting industry and the detail can be found on their official website.



European IIS 8.5 Hosting - UK :: Hosting node.js in IIS

clock October 15, 2014 07:40 by author Scott

In this post, I will discuss about hosting node.js application in IIS on Windows using iisnode project. OK, let’s begin.

First thing you need to do is install iisnode project side to get the module and samples installed on your Windows box with IIS7 enabled. The hello world sample consists of two files: hello.js and web.config.
This is the hello.js file from the helloworld sample:

var http = require('http');

http.createServer(function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('Hello, world! [helloworld sample]');
}).listen(process.env.PORT);

You will notice that the only difference between this code and the hello world sample from the front page of http://nodejs.org is in the specification of the listening address for the HTTP server. Since IIS controls the base address for all HTTP listeners, a node.js application must use the listen address provided by the iisnode module through the process.env.PORT environment variable rather than specify its own.

 

The web.config file is required to instruct IIS that the hello.js file contains a node.js application. Otherwise IIS would consider this file to be client side JavaScript and serve it as static content. The web.config designates hello.js as a node.js application by scoping the registration of the handler in the iisnode module to that file only:

<configuration>
 
<system.webServer>
   
<handlers>
     
<add name="iisnode" path="hello.js" verb="*" modules="iisnode" />
   
</handlers>   
 
</system.webServer>
</configuration>

This handler registration allows the same web site to contain other *.js files (e.g. jQuery libraries) that IIS will continue serving as static files.

The Advantages Using iisnode

WebSocket Support

As of version 0.2.x, iisnode supports hosting Websocket applications in IIS 8 on Windows Server 2012 and Windows 8. You can use any standard node.js modules that implement the Websocket protocol, including socket.io.

Scalability on multi-core servers

For every node.js application (e.g. hello.js above), iisnode module can create many node.exe process and load balance traffic between them. The nodeProcessCountPerApplication setting controls the number of node.exe processes that will be created for each node.js application. Each node.exe process can accommodate a configurable number of concurrent requests (maxConcurrentRequestsPerProcess setting). When the overall concurrent active request quota has been reached for an application (maxConcurrentRequestsPerProcess * nodeProcessCountPerApplication ), the iisnode module starts rejecting new HTTP requests with a 503 (Server Too Busy) status code. Requests are dispatched across multiple node.exe processes serving a node.js application with a round-robin load balancing algorithm.

Auto-update

Whenever the JavaScript file with a node.js application changes (as a result of a new deployment), the iismodule will gracefully upgrade to the new version. All node.exe processes running the previous version of the application that are still processing requests are allowed to gracefully finish processing in a configurable time frame (gracefulShutdownTimeout setting). All new requests that arrive after the JavaScript file has been updated are dispatched to a new node.exe process that runs the new version of the application. The watchedFiles setting specifies the list of files iisnode will be watching for changes.

Changes in the JavaScript file are detected regardless if the file resides on a local file system or a UNC share, but the underlying mechanisms are different. In case of a local file system, an OS level directory watching mechanism is used which provides low latency, asynchronous notifications about file changes. In case of files residing on a UNC share, file timestamps are periodically polled for changes with a configurable interval (uncFileChangesPollingInterval setting).

Integrated debugging

With iisnode integrated debugging you can remotely debug node.js application using any WebKit-enabled browser.

Access to logs over HTTP

To help in ‘console.log’ debugging, the iisnode module redirects output generated by node.exe processes to stdout or stderr to a text file. IIS will then serve these files as static textual content over HTTP. Capturing stdout and stderr in files is controlled with a configuration setting (loggingEnabled). If enabled, iisnode module will create a per-application special directory to store the log files. The directory is located next to the *.js file itself and its name is is specifed with the logDirectoryName setting (by default “iisnode”). The directory will then contain several text files with log information as well as an index.html file with a simple list of all log files in that directory. Given that, the logs can be accessed from the browser using HTTP: given a node.js application available at http://mysite.com/foo.js, the log files of the application would by default be located at http://mysite.com/iisnode/index.html.

The logDirectoryName is configurable to allow for obfuscation of the log location in cases when the service is publicly available. In fact, it can be set to a cryptographically secure or otherwise hard to guess string (e.g. GUID) to provide a pragmatic level of logs privacy. For example, by setting logDirectoryName to ‘A526A1F2-4E22-4488-B930-6A71CC7649CD’ logs would be exposed at http://mysite.com/A526A1F2-4E22-4488-B930-6A71CC7649CD/index.html.

Log files are not allowed to grow unbounded. The maxLogFileSizeInKB setting controls the maximum size of an individual log file. When the log grows beyond that limit, iisnode module will stop writing to that file and create a new log file to write to. To avoid unbounded growth of the total number of log files in the logging directory, iisnode enforces two additional quotas. The maxLogFiles setting controls the maximum number of log files that are kept. The maxTotalLogFileSizeInKB controls the maximum total size of all logs files in the logging directory. Whenever any of the quotas are exceeded, iisnode will remove any log files not actively written to in the ascending order of the last write time.

Note that this design of the logging feature allows the node.js application to be scaled out to multiple servers as long as the logging directory resides on a shared network drive.

Side by side with other content types

One of the more interesting benefits of hosting node.js applications in IIS using the iisnode module is support for a variety of content types within a single web site. Next to a node.js application one can host static HTLM files, client side JavaScript scripts, PHP scripts, ASP.NET applications, WCF services, and other types of content IIS supports. Just like the iisnode module handles node.js applications in a particular site, other content types will be handled by the registered IIS handlers.

Indicating which files within a web site are node.js applications and should be handled by the iisnode module is done by registring the iinode handler for those files in web.config. In the simplest form, one can register the iisnode module for a single *.js file in a web site using the ‘path’ attribute of the ‘add’ element of the handler collection:

<configuration>
 
<system.webServer>
   
<handlers>
     
<add name="iisnode" path="hello.js" verb="*" modules="iisnode" />
   
</handlers>
 
</system.webServer>
</configuration>

Alternatively, one can decide that all files in a particular directory are supposed to be treated as node.js applications. A web.config using the <location> element can be used to achieve such configuration:

<configuration>
 
<location path="nodejsapps">
   
<system.webServer>
     
<handlers>
       
<add name="iisnode" path="*.js" verb="*" modules="iisnode" />
     
</handlers>  
   
</system.webServer>
 
</location>
</configuration>

One other approach one can employ is to differentiate node.js applications from client side JavaScript scripts by assigning a file name extension to node.js applications other than *.js, e.g. *.njs. This allows a global iisnode handler registration that may apply across all  sites on a given machine, since the *.njs extension is unique:

<configuration>
 
<system.webServer>
   
<handlers>
     
<add name="iisnode" path="*.njs" verb="*" modules="iisnode" />
   
</handlers>   
 
</system.webServer>
</configuration>

Output caching

IIS output caching mechanism allows you to greatly improve the throughput of a node.js application hosted in iisnode if the content you serve can be cached for a time period even as short as 1 second. When IIS output caching is enabled, IIS will capture the HTTP response generated by the node.js application and use it to respond to similar HTTP requests that arrive within a preconfigured time window. This mechanism is extremely efficient, especially if kernel level output caching is enabled.

URL Rewriting

The iisnode module composes very well with the URL Rewriting module for IIS. URL rewriting allows you to normalize the URL space of the application and decide which IIS handlers are responsible for which parts of the URL space. For example, you can use URL rewriting to serve static content using the IIS’es native static content handler (which is a more efficient way of doing it that serving static content from node.js), while only letting iisnode handle the dynamic content.

You will want to use URL rewriting for majority of node.js web site applications deployed to iisnode, in particular those using the express framework or other MVC frameworks.

Minimal changes to existing HTTP node.js application code

It has been the aspiration for iisnode to not require extensive changes to existing, self-hosted node.js HTTP applications. To that end, most applications will only require a change in the specification of the listen address for the HTTP server, since that address is assigned by the IIS as opposed to left for the application to choose. The iisnode module will pass the listen address to the node.exe worker process in the PORT environment variable, and the application can read it from process.env.PORT:

var http = require('http');

http.createServer(function (req, res) {
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('I am listening on ' + process.env.PORT);
}).listen(process.env.PORT); 

If you access the endpoint created by the application above, you will notice the application is actually listening on a named pipe address. This is because the iisnode module uses HTTP over named pipes as a communication mechanism between the module and the worker node.exe process. One implication of this is HTTPS applications will need to be refactored to use HTTP instead of HTTPS. For those applications, HTTPS can be configured and managed at the IIS level itself.

Configuration with YAML or web.config

The iisnode module allows many of the configuration options to be adjusted using the iisnode.yml file or the system.webServer/iisnode section of web.config. Settings in the iisnode.yml file, if present, take precedence over settings in the web.config. Below is the list of options (most of which were described above) with their default values.

# The optional iisnode.yml file provides overrides of
# the iisnode configuration settings specified in web.config.

node_env: production
nodeProcessCommandLine: "c:\program files\nodejs\node.exe"
nodeProcessCountPerApplication: 1
maxConcurrentRequestsPerProcess: 1024
maxNamedPipeConnectionRetry: 100
namedPipeConnectionRetryDelay: 250
maxNamedPipeConnectionPoolSize: 512
maxNamedPipePooledConnectionAge: 30000
asyncCompletionThreadCount: 0
initialRequestBufferSize: 4096
maxRequestBufferSize: 65536
watchedFiles: *.js;iisnode.yml
uncFileChangesPollingInterval: 5000
gracefulShutdownTimeout: 60000
loggingEnabled: true
logDirectoryName: iisnode
debuggingEnabled: true
debuggerPortRange: 5058-6058
debuggerPathSegment: debug
maxLogFileSizeInKB: 128
maxTotalLogFileSizeInKB: 1024
maxLogFiles: 20
devErrorsEnabled: true
flushResponse: false
enableXFF: false
promoteServerVars:

Configuration using environment variables

In addition to using web.config and iisnode.yml, you can also configure iisnode by setting environment variables of the IIS worker process. Every setting available in iisnode.yml can also be controlled with environment variables. This option is useful for hosting providers wishing to offer a web based management experience for iisnode.

Integrated management experience

The iisnode module configuration system is integrated with IIS configuration which allows common IIS management tools to be used to manipulate it. In particular, the appcmd.exe management tool that ships with IIS can be used to augment the iismodule configuration. For example, to set the maxProcessCountPerApplication value to 2 for the “Default Web Site/node” application, one can issue the following command:

%systemroot%\system32\inetsrv\appcmd.exe set config "Default Web Site/node" -section:iisnode /maxProcessCountPerApplication:2

This allows for scripting the configuration of node.js applications deployed to IIS.



IIS 8.5 Hosting - HostForLIFE.eu :: How to Fix: “HTTP Error 401.3 – Unauthorized” Error in IIS ?

clock October 8, 2014 08:05 by author Peter

Today, I am going to show you how to fix How to Fix: “HTTP Error 401.3 – Unauthorized” Error in IIS. While working on my site, I got a small issue with IIS. I had set up a new virtual directory for the site but when the site was viewed in the browser the IIS error was displayed:
Server Error in Application “DEFAULT WEB SITE”
HTTP Error 401.3 – Unauthorized
You do not have permission to view this directory or page because of the access control list (ACL) configuration or encryption settings for this resource on the Web server.

As you can see on the picture below:

Judging from the error the permissions on the folder was incorrect. And a quick peek at the properties confirmed this. Admittedly, I don’t have much experience with  IIS 7+ (IIS 6 & 6.5 that’s a different story). So when I tried to add the correct user account to the I couldn’t identify the correct user account. Honestly, I was actually looking for IUSR_MachineName . As it turns out IUSR_MachineName was removed in IIS 7 and replaced with IUSR. So adding the IUSR user account to the folder and everything worked. Yes, it was a simple fix but it can be an annoying one if you don’t know what to look for.



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