IIS 7.5 and IIS 8.0 European Hosting

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

IIS Hosting Europe - HostForLIFE :: Look at Logging in IIS 7 and IIS 7.5

clock January 27, 2023 07:11 by author Peter

In this article, we will look into the built-in logging features of IIS 7 and 7.5 to log request details. An IIS log is a useful resource to troubleshoot requests. In IIS 7 and 7.5, we can log the details of a request, such as client IP, time taken, response size, cookie and so on into a file. This information helps to find the load on the server in terms of number of requests, size and time taken to serve the request.

Let's open IIS, configure logging for a website and analyze it. We can configure logging at server level or website level. Let's do it at the website level. Go to Default Web Site, go to the Logging feature and click "Enable":

In the following Logging dialog, we can configure the format of the log file, it can be:

  • IIS: IIS log file format is a fixed ASCII text-based format, so you cannot customize it (Can't select fields) and fields are separated by commas.
  • W3C (default format): It is a customizable ASCII text-based format. You can use IIS Manager to select which fields to include in the log file and fields are separated by spaces.
  • NCSA: its log file format is a fixed ASCII text-based format, so you cannot customize it and contains less information than an IIS log format.
  • Custom: ODBC logging is implemented as a custom logging module and helps to log information into ODBC-compliant databases like SQL Server or Microsoft Access.

Select W3C as log format, click on "Select Fields" and choose the fields that need to be logged in the log file.

We can set the location or directory for the log files, set options to create a new log file based on file size, daily or weekly and so on. When we check "Use local time for file naming and rollover" it will use the local server time instead of UTC for log file naming and time for log file rollover. This setting will not affect the time field format of the request logged in the file and uses UTC time format.

Let's may a request to welcome.png present in the Default Web Site and analyze the log file. This log file will be under the path set in the Logging Feature + W3SVC<website identifier>. In my case, it is "C:\inetpub\logs\LogFiles\W3SVC1" and contains the following information:

Most of the fields are self-explanatory and field prefixes have the following meanings:

    s- Server actions
    c- Client actions
    cs- Client-to-server actions
    sc- Server-to-client actions
    sc-bytes - response size
    cs-bytes - request size.

The Time-taken field will show the total time taken to generate the response as well as the time to send the complete response to the client until the last byte. This is done by taking into account the last ACK from the answer to the response. Let's say a request took 5000 milliseconds to generate the response and 3000 milliseconds to send the complete response to the client, so it will show time-taken as 8000 milliseconds.

Most of the preceding logging features are also available on a FTP site as well. In most of the cases, your log file will be very large and can't be analyzed in a notepad. In that scenario, we can use the Log Parser (Available here). Let's install it and open our log file as shown below:

Click on New Query from File Menu and select Log type as IISW3CLOG and hit F5. The result will be as shown below:


We can even write our own queries in SQL syntax to filter the data:
SELECT TOP 10 * FROM '[LOGFILEPATH]' where time-taken >100

As well, there are a few sets of built-in queries for IIS in the Library tab as shown below:


By using the Log Parser Studio, we can analyse large log files to determine load and performance issues at the page or user level. We can use IIS logs as a first step to troubleshoot performance issues. This log helps us to determine any performance issues that exist or not. If any exist then which page is taking time to respond and so on. I will end this article, by mentioning tools helpful in troubleshooting IIS issues in scenarios like a crash, hang, high CPU or memory and so on (we will discuss the following tools in depth in future articles):

    IIS Logging
    IIS Advanced Logging
    FREB Tracing [Failed Request Tracing]
    Fiddler or IE Developer Tools
    Memory dumps collection ofw3wp.exe using Debug Diag or AD Plus.
    Memory dumps analysis using WinDbg tool.

I hope this article will be helpful for all.



IIS Hosting Europe - HostForLIFE :: Create Virtual Directory In IIS

clock January 20, 2023 07:05 by author Peter

In this post I’m going to tell how to create a virtual directory in IIS. Most of the ASP.NET beginners wonder about how to create a virtual directory in IIS. In order to help them, I prepared this post. Before you proceed just check you have installed IIS on your local machine. If not, please check my previous post here,

What is Virtual Directory?
Virtual directory is a mapping between the actual web application files and IIS. That is we map the website files to the IIS in Virtual Directory. If you see in IIS, it looks like a directory but it actually points the exact web application path.

Create Virtual Directory
Here I’m going to create a virtual directory in IIS for the web application which is located in the path:  “G:\DotNetExamples\AllInOne”,

Step 1: Open IIS. To open IIS, press windows key + R key, which opens “Run” window and type “inetmgr” and press enter, which opens the IIS.

Step 2: In IIS, right click on the “Default Web Site” and select the “Add Application” in the float menu.

Step 3: In this “Add Application” window, we need to specify the “Virtual Directory” name and the physical directory where the actual web site files are located. Leave the application pool as it is. Click OK.


Step 4: Now the Virtual Directory has been created under the “Default Web Site”. To test the application right click the virtual directory and choose “Manage Application, then Browse” which will open the application in the respective default browser.

Hope this helps beginners!



IIS Hosting Europe - HostForLIFE :: Deploying A Blazor Application On IIS

clock January 10, 2023 08:07 by author Peter

In this article, we will understand how to deploy an ASP.NET Core hosted Blazor application with the help of IIS 10 on a Windows 10 machine. We will use Visual Studio 2017 to publish the app and SQL Server 2014 to handle DB operations. We will also troubleshoot some of the common hosting issues for a Blazor application.

Prerequisites
Install IIS in your machine
Install URL Rewrite module from here

Please refer to my previous article Cascading DropDownList in Blazor Using EF Core to create the application that we will be deploying in this tutorial.

Installing .NET Core hosting bundle

Since we are going to deploy an ASP.NET Core hosted Blazor application, the first step is to install the .NET Core hosting bundle in our machine.
Follow the below steps to download .NET Core hosting bundle,

Step 1 
Open https://www.microsoft.com/net/download/all

Step 2 
Select the latest non-preview .NET Core runtime from the list. For this tutorial, we will select the .NET Core Runtime 2.0.7.

Refer to the image below, 

Step 3

On the .NET Core runtime download page, scroll down to the Windows section, select the “Hosting Bundle Installer” link to download the .NET Core Hosting Bundle. Once the download is finished, double-click to start installing it. You will see a window similar to the one shown below,

Important Note
  1. .NET Core hosting bundle should be installed after installing IIS only. If you install.NET Core hosting bundle before installing IIS then you need to repair it after installing IIS so that it will update its dependencies for IIS.
  2. Restart the machine after installing the .NET Core hosting bundle.
Publishing the Blazor application
Once .NET Core hosting bundle installation is successful and you have restarted your machine, open the Blazor application solution using VS 2017.

Right-click on the Server project of your solution and click publish. In this case, it will be BlazorDDL.Server >> Publish.

You will see a screen similar to below. Select the folder from the left menu and provide a folder path. You can provide any folder path where you want to publish your app.

Click on publish. Visual Studio will start publishing your application. If there are no build errors, then your application will be published successfully in the folder you have mentioned. After the publishing is successful, we will move on to configure IIS.

Configuring IIS
Open IIS and right-click on Sites >> Add Web Site.
An “Add Website” pop up box will open. Here we need to furnish details in three fields
  1. Site name: Put any name of your choice. Here I put "ankitsite"
  2. Physical Path: The path to the folder where you have published your application.
  3. Host name: This is the name we put in the browser to access our application. We will put ankitsite.com for this demo.
Click on OK to create the website. Refer to the image below:

Next step is to configure the “Application Pool” for our site. The application pool name will be the same as the “Site name” we have provided in the last step. Therefore, in this case, the application pool name will be “ankitsite”. Click to “Application Pools” from the left panel and double click on the pool “ankitsite”. It will open an “edit application pool” window. Select “No Managed Code” from the .NET CLR version drop-down. Refer to the image below:

Configuring the DNS host
The last step is to configure our DNS host file.

Navigate to C:\Windows\System32\drivers\etc path in your machine and open the “hosts” file using any text editor.


We need to add the hostname that we provided in IIS against the localhost IP address. Refer to the image below,

Hence, we have successfully hosted a Blazor application on IIS.
 
Execution Demo
 Open any browser on your machine and enter the hostname you have configured. You can see that the application will open in the browser window.

Troubleshooting common hosting issues
 
In this section, we will look into some of the common problems that you can face while hosting a Blazor application.
  • If you are unable to open the website and get a DNS not found an error
Check if the hostname is configured correctly in the host file. Make sure that your machine is not connected to any VPN server. Also, if you are using any Web proxy then disable it.
  • HTTP Error 500.19 – Internal Server Error - The requested page cannot be accessed because the related configuration data for the page is invalid. 
This error message is clear. The publish folder is inaccessible because of insufficient permissions. Grant Read permission to the IIS_IUSRS group on the publish folder so that it can access Web.config file.
  • If the website is loading but data is not getting populated and you get a 500 Internal server error 
Make sure that your connection string is in the correct format. The user id that you have specified in your connection string should have db_datareader and db_datawriter permissions. If the issue persists then provide the user with db_owner permission
  • If the data is not getting populated and you get an “operation not allowed” exception 
This issue generally appears when you try to do a PUT, POST or DELETE operation in your web API. To mitigate this issue we need to alter the IIS setup configuration.
Navigate to Control Panel >> Turn Windows feature on or off. Then navigate to Internet Information Services >> World Wide Web Services >> Common HTTP Features and uncheck the “WebDAV Publishing” option and click ok. Refer to the image below,
 

  • “Failed to load <web API> : No 'Access-Control-Allow-Origin' header is present on the requested resource.
The cause of this error is that the client and the server of the application are not on the same port. The browser will restrict the application to make web API calls due to same-origin policy. To resolve this issue you need to enable Cross-Origin Requests (CORS) in your application. 
  • If you republish the application then do not forget to refresh your website as well as the application pool in IIS. 

Conclusion

 
In this article, we learned how to deploy a Blazor application on IIS in windows machine. We also learned how to resolve some of the common hosting issues while deploying a Blazor application.


IIS Hosting Europe - HostForLIFE :: WebApi Hosting in Internet Information Server (IIS 7.5)

clock December 23, 2022 07:46 by author Peter

The Web API is a platform to develop HTTP / HTTPS based services that can be used by native applications like on smartphones, tablets and browsers. The WebApi is a core part of ASP.NET and provides ways to create Restful services and can be used by any application that can understand HTTP communications.


This article will cover the hosting of a WebApi in IIS using a sample demo. I hope you have gone through with the link above and now you at least understand the execution of WebApi. In this article we'll host the WebApi in IIS and execute all the CRUD operations step-by-step.

Step 1
Build your solution in release mode.

To build the solution, kindly download the sample application from the link Restful CRUD Operations in WebApi Using ADO.NET Objects and SQL Server and start working further. Please choose the release option from the dropdown list as encircled in red.

Step 2
Right-click on the project and choose the publish command to publish the Web API. Kindly look at the images shown below.

As soon as you click on the publish button it publishes the build and prompts for a message in the bottom of success as shown in the image below:

Step 3
Now type "Inetmgr” in the Start window and click on inetmgr to open IIS as shown in the image below:

Step 4
To add a new application as a virtual directory right-click on the default website and click on the Add application property. Please refer to the following image.


Provide an alias name of your choice and provide the physical path from your directory.

Note:
    It should be a published solution path that we've created in Step 2 above.
    Change the application pool “DefaultAppPool” to ASP.Net v4.0 after clicking on the “select” option. If you encounter an error like “unrecognized attribute 'targetframework'. Note that attribute names are case-sensitive IIS7” then here is the solution for that.

Step 5
The sample application has been hosted in IIS

The preceding Blue screen shows that the Web API is up and running. I've used Fiddler to trace the requests, so I will open Fiddler to execute the following link to retrieve the information of the EmployeeId 15: http://localhost/hfl/api/Employees/GetEmployeeById/15

 

Execution of AddEmployee (POST) Method of WebApi
Since the WebApi is already in running mode, I'll execute the following link to add an employee to the database. http://localhost/hfl/api/Employees/AddEmployee and will pass the following JSON parameters { "EmployeeId": 30, "Name" : "Peter", "ManagerId" : 7 }.


 

Please open the database to confirm whether or not the user has been added to the database. We are nearly done with the execution of the Post method.

Execution of DeleteEmployeeById (Delete) Method of WebApi.
Now open the EmployeeController again and paste the following code into that as the Delete WebApi method:

Since the WebApi is already in running mode, I'll execute the following link to delete an employee by the employee id database. http://localhost/DotnetPiper/api/Employees/Delete/20.

Note: If you face an error at time of execution of DELETE and PUT.Kindly refer this link for resolution.

WepApi HTTP Error 405.0 - Method Not Allowed

Please open the database to confirm that EmployeeId “20” has been deleted. Kindly look at the image shown below.

Note: I have intentionally left the implementation of the Update method so that the end user can have hands-on to this. I'll also add a database backup for user help.

Go through with these detailed links to learn more about the WebApi.
    How MediaTypeFormatter and MediaTypeMapping are associated with each other in the WebApi.
    WebAPI: MediaTypeFrommatters in WebAPI.

Detailed links to learn more about the WebApi.

Points to consider:
    You should have a little knowledge of the WebApi.
    You should have knowledge of the Fiddler tool to execute the functionality.
    There is a need for SQL Server also.

I hope it will help you somewhere down the line.
Keep coding and smiling.



IIS Hosting Europe - HostForLIFE :: netTcpBinding In WCF Service With IIS Hosting

clock December 16, 2022 06:50 by author Peter

Today, we will learn about creating the WCF Service using netTcpBinding and hosting it on IIS Server. If you are new to WCF, then please read my previous article (Create Simple WCF Service And Host It On Console Application).


Now, let's make simple WCF Service which gives the sum of two numbers.

Start the Visual Studio with administrator rights and create one class library project named as 'WCFAddition'.

This will generate default class file automatically. So, we have to delete it and add one new item as 'WCF Service' with the same name, 'WCFAddition'. This will generate one class file and one interface (WCFAddition.cs and IWCFAddition.cs).

Open the interface file and create method 'SumOfTwoNumber'.

    [ServiceContract] 
    public interface IWCFAddition { 
        [OperationContract] 
        void DoWork(); 
        [OperationContract] 
        int SumOfTwoNumber(int num1, int num2); 
    } 

Now, implement this interface on class file.
    public class WCFAddition: IWCFAddition { 
        public void DoWork() {} 
        public int SumOfTwoNumber(int num1, int num2) { 
            return num1 + num2; 
        } 
    }

Now, let's build the project solution and then add new web site in same solution for IIS hosting.

Give reference of WCF Service to this new website, as shown below.

Now, open Service.svc file and modify it as below.
    <%@ ServiceHost Language="C#" Debug="true" Service="WCFAddition.WCFAddition"%>   

The main part will start now and we have to make changes in web.config file. So here, first we have defined endpoint with netTcpBinding and then defined the base address for the same, as show below.
    <services> 
        <service name="WCFAddition.WCFAddition"> 
            <endpoint binding="netTcpBinding" bindingConfiguration="ultra" contract="WCFAddition.IWCFAddition" /> 
            <host> 
                <baseAddresses> 
                    <add baseAddress="net.tcp://localhost:5050/implementclass" /> 
                    <add baseAddress="http://localhost:5051/implementclass" /> </baseAddresses> 
            </host> 
        </service> 
    </services>  

Define the behavior for the netTcpBinding.
    <behaviors> 
        <serviceBehaviors> 
            <behavior> 
                <serviceMetadata httpGetEnabled="true" /> 
                <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> 
        </serviceBehaviors> 
    </behaviors>  

Define binding as netTcpBinding with its default parameter properties. Also, define the security mode.
    <bindings> 
        <netTcpBinding> 
            <binding name="ultra" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="2147483647" maxReceivedMessageSize="2147483647" portSharingEnabled="false" transactionFlow="false" listenBacklog="2147483647"> 
                <security mode="None"> 
                    <message clientCredentialType="None" /> 
                    <transport protectionLevel="None" clientCredentialType="None" /> </security> 
                <reliableSession enabled="false" /> </binding> 
        </netTcpBinding> 
    </bindings>  

Full web.config
    <?xml version="1.0"?> 
    <configuration> 
        <appSettings> 
            <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" /> </appSettings> 
        <system.web> 
            <compilation debug="false" targetFramework="4.5.1" /> 
            <httpRuntime targetFramework="4.5.1" /> </system.web> 
        <system.serviceModel> 
            <services> 
                <service name="WCFAddition.WCFAddition"> 
                    <endpoint binding="netTcpBinding" bindingConfiguration="ultra" contract="WCFAddition.IWCFAddition" /> 
                    <host> 
                        <baseAddresses> 
                            <add baseAddress="net.tcp://localhost:5050/implementclass" /> 
                            <add baseAddress="http://localhost:5051/implementclass" /> </baseAddresses> 
                    </host> 
                </service> 
            </services> 
            <bindings> 
                <netTcpBinding> 
                    <binding name="ultra" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="2147483647" maxReceivedMessageSize="2147483647" portSharingEnabled="false" transactionFlow="false" listenBacklog="2147483647"> 
                        <security mode="None"> 
                            <message clientCredentialType="None" /> 
                            <transport protectionLevel="None" clientCredentialType="None" /> </security> 
                        <reliableSession enabled="false" /> </binding> 
                </netTcpBinding> 
            </bindings> 
            <behaviors> 
                <serviceBehaviors> 
                    <behavior> 
                        <serviceMetadata httpGetEnabled="true" /> 
                        <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> 
                </serviceBehaviors> 
            </behaviors> 
            <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> </system.serviceModel> 
        <system.webServer> 
            <modules runAllManagedModulesForAllRequests="true" /> 
            <!-- 

     
To browse web app root directory during debugging, set the value below to true.     
Set to false before deployment to avoid disclosing web app folder information. 
    --> 
            <directoryBrowse enabled="true" /> </system.webServer> 
    </configuration>  

Now, when we have built the solution, we have to host it on IIS. So, open the IIS type 'inetmgr' command on run window.

It will open IIS. Go to ‘Sites’ and add new website

New window is open now. Give it a name as 'WCF_Addition' and assign physical path of your IIS project.

Now, in 'binding' section, select Type as http and add port '5051'. Click on OK button.

 

Now, select your web site and click on ‘Advance settings', as shown in the below image.

In 'Behavior' => 'Enable Protocols' = http,net .tcp and click on OK.

Now, click on 'Binding' link >> 'Add' button >> and add "net.tcp" and "505:*"

Our service is hosted now. Let's check it.


You can see that the service is hosted successfully on IIS and you can browse it on given URL.


 



IIS Hosting Europe - HostForLIFE :: IP Address and Domain Restrictions in IIS 8

clock December 2, 2022 06:32 by author Peter

This article covers how to configure Dynamic IP Restrictions.

Introduction
IP Address and Domain Restrictions is one of the great built-in features of IIS 8. Configuring this feature allows a website administrator to selectively permit or deny access to the web server, websites, folders or files that makes your server more secure. One can configure and set the limits based on specific IP address(es) or frequency of requests from a specific IP over a period of time. By default all the clients requesting the website are permitted all access unless specifically rejected.


Background
This feature was available in previous versions of IIS where you can block one IP or range of IP addresses. The disadvantage in this was first you need to know the person doing suspicious activity on your website based on the tools like Log Parser for checking the site logs then you can just block that IP or range of IP addresses using Deny Rules. Most of professional attackers (hackers) will use a variety of IPs from proxy servers so by the time you've blocked a handful a new range could be starting up.

Installing IP Address and Domain Restrictions in IIS 8

This feature is not installed by default. One must install the feature from the Turn Windows features On and Off window.

For that use the following procedure:

  1. Open the Control Panel.
  2. Click on the Programs feature.
  3. In that Click on Turn Windows features on or off under Programs and Features.
  4. Install the required features.

Configuring IP address and Domain Restrictions in IIS Manager
Open the IIS Manager. (Click WIN+R, enter inetmgr in the dialog and click OK. Alternatively, search for IIS Manger in the Start window).
Click on the IP Address and Domain Restrictions feature in the feature pane under the IIS section.

Once you opened this feature, you will see a window as in the following image.

The Action Pane elements are the elements used for defining the rules for allowing or denying the specific IP address(es). Let's have a deeper look into each of these elements.
Edit Feature Settings
This action is used for specifying the default access to all unspecified clients in Add and Deny rules.
On clicking this action, it will open up a window as in the following image.

Select Allow in the Access for unspecified clients dropdown if you are to allow all clients by default else select Deny.

If you want to configure rules based on the client's DNS name then check the Enable Domain Name Restrictions checkbox. If you click on OK to save the settings when this checkbox was checked then it will show a warning (as in the following image) that states that doing DNS lookups is a potentially expensive operation. Click on Yes to enable DNS lookup restrictions.

If you want to enable the requests that come through a proxy server then check Enable Proxy Mode checkbox.
Choose the Default Deny Action Type for sending the response to clients when you are denied a request. It can be either Unauthorized (401), Forbidden (403), Not Found (404) or Abort the request.
Once you have selected your options click on OK to save the settings.

Add Allow/ Deny Entry
These two action types are used for defining the rule for allowing or blocking the specific IP address or range of IP addresses.
On clicking the action, it will open one window as provided in the following image.

To create a rule for a specific IP Address, select Specific IP Address and enter the client IP address in the provided TextBox.
To create a rule for a range of IP addresses, select IP address range and enter the subnet and subnet mask in the provided textboxes. For example, to permit access to all IP addresses in the range from 192.168.8.0 to 192.168.8.8 then enter the subnet as 192.168.8.0 and subnet mask as the 255.0.0.0.

If you have enabled Domain Name Restrictions in the feature settings, then you will be able to set restrictions based on DNS names else this option will not be available. To create a rule for a client domain name, then select Domain name and enter the DNS name.

After entering the details click on OK to add the rule.

Edit Dynamic Restriction Settings
This is the new feature that came with IIS 8.
On configuring this feature one can secure their web applications from automated attacks like Dictionary attacks.
This action allows to dynamically determine whether to block certain clients, based on number of concurrent requests at a time or number of requests over a period of time.
On clicking this action, it will open a window as provided in the following image.

If you want to restrict the client based on a number of concurrent requests, then check the Deny IP Address based on number of concurrent requests check boxand enter Maximum number of concurrent requests count in the provided TextBox.

If you want to restrict the client based on number of requests over a period of time, then check the provided checkbox and enter the details in the provided textboxes.

Check the Enable the Logging Only Mode checkbox if you want IIS to log requests that would be rejected.

View Ordered List
This action is used for changing the rule priority.
On clicking this action, you will be able to see the screen that is showing rules places in the order and with multiple action elements as provided in the following image.

Rules located at the top of the list have higher priority.
Use Move Up and Move Down actions to change the priority of the rules.
Once you are done with changing the order of the rules then click on View Unordered List to return to the screen that allows you to add and remove rules.

Remove

This action is used to remove the rules that are not required.
To view this action click on any of the rules in the feature pane and then click on Remove to remove the rule.
On clicking Remove, you will get a warning as in the following image. Click on Yes to remove the rule.

Feature pane elements that give the information about the rules are applicable to the current web site or virtual application.
    Mode
      This displays the type of rule. It contains the values, either Allow or Deny, that indicates whether the created rule is to allow or deny access to content.

    Requester
      This displays the specific IP address or range of IP addresses or domain name defined in the Add Allow/Deny Restriction Rule.

    Entry Type
      This displays whether the item is local or inherited. Local items are added in the current application level and inherited items are added from a parent application level.



IIS Hosting Europe - HostForLIFE :: Look at HTTP API Logs in IIS 7

clock November 25, 2022 06:47 by author Peter

In this article, we will look into the HTTP API error log feature of IIS 7/ 7.5, when to use it and how to analyze it. When a connection times out, dropped or a request is orphaned on your website, it will be logged in the HTTP API error log file by IIS under "c:\Windows\System32\LogFiles\HTTPERR\httperr#.log". This file helps us to identify the following kinds of errors:


    Connection time-outs for a pending request.
    Orphaned requests when w3wp.exe crashes or stops unexpectedly, while there are pending queued requests.
    Error responses to clients like parser errors.

Let's look at the following sample HTTPERR#.LOG file:In this article, we will look into the HTTP API error log feature of IIS 7/ 7.5, when to use it and how to analyze it. When a connection times out, dropped or a request is orphaned on your website, it will be logged in the HTTP API error log file by IIS under "c:\Windows\System32\LogFiles\HTTPERR\httperr#.log". This file helps us to identify the following kinds of errors:

    Connection time-outs for a pending request.
    Orphaned requests when w3wp.exe crashes or stops unexpectedly, while there are pending queued requests.
    Error responses to clients like parser errors.

Let's look at the following sample HTTPERR#.LOG file:

It shows date, time, client's IP, port as well the s-reason field that shows specific error types, like BadRequest, Connection_Dropped and the following is the explanation for that field's value:

s-reason Description
AppOffline A service unavailable error occurred (an HTTP error 503). The service is not available because application errors caused the application to be taken offline.
AppPoolTimer A service unavailable error occurred (an HTTP error 503). The service is not available because the application pool process is too busy to handle the request.
AppShutdown A service unavailable error occurred (an HTTP error 503). The service is not available because the application shut down automatically in response to administrator policy.
BadRequest A parse error occurred while processing a request.
Client_Reset The connection between the client and the server was closed before the request could be assigned to a worker process. The most common cause of this behavior is that the client prematurely closes its connection to the server.

This field will help us to understand what exactly caused the problem like Application Pool is down or is it a Bad request or a connection timed out.

We can use the Log Parser to better analyze HTTPERR#.LOG files. Open the Log Parser and point to the log file as shown below:

Go to the library and filter it by httperr as shown below:


Let's find abandoned requests by selecting "HTTPERR: Abandoned Requests" and hitting F5 to execute the query:


Analyzing HTTPERR#.LOG with the Log parser will help us to identify connection time-outs, orphaned requests, bad requests and so on quickly.



IIS Hosting Europe - HostForLIFE :: Access Website Hosted In IIS On Windows 10 From Any PC On LAN

clock October 21, 2022 08:07 by author Peter

In this article, we will learn about Access Website Hosted In IIS On Windows 10 From Any PC On LAN


Prerequisites

    Windows 10 PC with IIS installed. (In this example IIS version is 10 )
    Basic knowledge of website hosting on IIS.

Create a website in IIS
 
Open run (windows key + R) and type inetmgr and press enter or in Cortana Search type IIS.

IIS Manager opens.
Then right click on Sites and click on Add Website. The Add website dialog opens.

    Fill in required details and select folder where compiled code is located. Eg: C:\Nigel\Publish
    Select required port , default is 80. I will be using 7500.
    Do not enter host name details if you are testing or using on LAN.

Then click ok. A website gets created and it will show under Sites.
 

Now right click on website name then Manage website and then click browse.


The link should be in the form on http://localhost:7500/  if you used port 7500 and selected http.
Locate your IP Address

Now open command prompt. Type cmd in run.


Type ipconfig and press enter. Now locate your PC's IP address on the LAN.


Now in your website link replace localhost with 192.168.0.24 (IP address) so your URL will be - http://192.168.0.24:7500/
Try it in your browser to make sure it works.
 
Change Firewall Rules
In Cortana search type firewall then click on Windows firewall with advanced security.


The firewall window opens.


Click on Inbound rules on the left. Then click new Rule in the right side menu.

The New inbound rule wizard will open. What type of rule would you like to create? Select Port and click Next.

In Does this rule apply to TCP or UDP? Select TCP. Then enter port number (7500) in specific local ports textbox. Then click Next >.

Then the Action form opens. Select Allow the connection and click Next .


Then the profile form opens. In the When does this rule apply? - Select required ones , if not sure then select all. Click Next.

Give this Firewall rule a Name and Description, so you know for what purpose you created this. Then click finish.


Now if you share the link we created earlier with someone else on your LAN it should open your website.
Link example: http://192.168.0.24:7500/
 
Note
    Be careful when changing Firewall setting otherwise you may leave your PC vulnerable to online attacks.
    Only use ports in non standard range (preferably after 9000).
    Once you are done using the website you can delete the Firewall rule.

Summary
In this article, we learned about Access Website Hosted In IIS On Windows 10 From Any PC On LAN.



IIS Hosting Europe - HostForLIFE :: Configure IIS to host your website without Asp.net

clock October 14, 2022 10:44 by author Peter

This article describes how to set up IIS on your PC then host your web site without

Visual Studio Installed.
If you want, in a Client's machine if you don't install Visual Studio but want to host your website in it then you can do this. It can be very usefull for you.

Step 1 : Install IIS on Your Server Machine
Go with this way .

Start -> Control Panel -> Add Remove Programs -> Add/Removes Windows Components.
Then click on Window Component Wizard Internet Information Service (IIS)

Click the Checkbox for Internet Information Service (IIS) then click the next button and select browse to XP Installation CD for Required Files.
 
Then install the .Net Framework.

Step 2 : Install .Net Framework on Your Server Machine.
After IIS installation, install the .Net Framework; which one depends on what you used to develop your web site.


Step 3: After Installation Set Your Web Site For hosting

After IIS installation, on the C drive the Inetpub folder is created.

Copy and paste your web site folder into the wwwroot folder.

Inetpub -> wwwroot -> yourwebsitefolder

Step 4: After pasting your folder is set on the default web site.

Right-click on My Computer then click the manage option.

Manage -> Computer management (Local) -> Internet Information Service -> Website -> Default Web Site.

On right-click default Web Site Click New -> Virtual Directory.

On Virtual Directory Creation Wizard click next then set Alias Name.
After write alias name click next and browse your directory on wwwroot folder website . . then set all Access Permission Checked.
Read...Write...Browse

After finishing check the .Net Framework version; on right-click for your web site properties on the ASP.NET tab. If the version is not selected then choose it ASP.Net Version and set it. Then browse to your web site.

And in the client machine that you want to run the web site in, give the URL with server IP address.

http://192.168.192.1/Onlineshoping/Index.aspx

Enjoy Your Web Project.

Conclusion:
I am try do something helpful.



IIS Hosting Europe - HostForLIFE :: How To Deploy React Application On IIS Server?

clock August 31, 2022 09:31 by author Peter

Today, I am going to show you how to deploy the React App to the IIS server, so let's grab a cup of coffee and start coding.

 
What is IIS?
IIS stands for "Internet Information Services", which is a web server provided by Microsoft to host the websites and other stuff on the web.
 
How to enable IIS?
If you have already enabled IIS then you can skip this step. But if you have not enabled it already then follow the below steps:
    Open Control Panel and then click on the "Programs and Features".
    Click on "Turn Windows features on or off".
    Select Internet Information Services and click on the OK button.
    To see whether or not IIS is enabled, press Windows + R key and type inetmgr and click on OK.
    IIS Manager is open.

Create a Simple React App
Open a command prompt or your favorite terminal and type the below command to create a react app.
    npx create-react-app my-react-app  

 After successfully creating the app go to the new app.
    cd my-react-app  

To see how it look likes type the below command.
    npm start  

and it will start the development server and navigate you to http://localhost:3000/
 
You can see the default landing page:

To host an app in any web server we first need to create a production build. To create a production build of our react app use the below command.

    npm run build  

The output of the above command creates a new build folder inside the project which contains production build. So far we have created a React app & created a production build of that app. Now the next step is to deploy it on IIS. Press Windows + R key and write inetmgr to open the IIS Manager. You can see the below screen.

 
First, we will create a new Application Pool, so right-click on Application Pools and click on Add Application Pool. Then give it a name as you want and click on OK button.
 
After that right-click on the new app pool and select Advanced Settings. You will see the below window.


Then click on Identity and choose a Custom account and click on the set button and then add your windows credentials and click on OK.
 
After that right-click on Sites and then click on Add Website. Add the Site name and select application pool which we created earlier. After that under the physical path section, you have to give the path of build folder & also give the port number where you want to host.

Now right click on new website i.e ReactApp -> Manage Website -> Browse. Your react app is now successfully deployed.


Now the next step is to add routing in our react application. So I have created 2 components and also added react-router-dom package for routing. Here we are not going into detail about react routing.
 
Home page

Blog page

 

Create a production build again and try to browse the application which we hosted on IIS. You will see the application is working fine but now try to refresh the page and see what happens. You will get the below error.

So to fix this issue you have to install URL Rewrite module. After successful installation, you have to create a web.config file under public folder of app and copy-paste the below content into it.
<?xml version="1.0"?>  
<configuration>  
<system.webServer>  
    <rewrite>  
        <rules>  
            <rule name="React Routes" stopProcessing="true">  
                <match url=".*" />  
                <conditions logicalGrouping="MatchAll">  
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />  
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />  
                    <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />  
                </conditions>  
                <action type="Rewrite" url="/" />  
            </rule>  
        </rules>  
    </rewrite>  
</system.webServer>  
</configuration>     


Again build the application in production mode and browse. So now if you refresh the app you will not get an error and will be able to see the correct page. That's it -- so you have successfully created and deployed React application into the IIS server.

Conclusion

I hope that you have enjoyed this article, and please do not hesitate to send me your thoughts or comments about what could I have done better.



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