ASP.NET Core 1.0 on IIS error 502.5


I had this problem aswell (The error occurred both on VS 15 and 17). However on VS15 it returned a CONNECTION_REFUSED error and on VS17 it returned ASP.NET Core 1.0 on IIS error 502.5.


  1. Navigate to your project directory and locate the hidden folder .vs (it’s located in the projects folder dir). (Remember to show hidden files/folders)
  2. Close VS
  3. Delete .vs-folder
  4. Start VS as admin (.vs-folder will be recreated by VS)

Solution to “Unable to Launch the IIS Express Web Server”


This article will help you to overcome the error Unable to Launch the IIS Express Web Server. Today I encountered the issue “Unable to launch the IIS Express Web Server” while I was running my Visual Studio 2012. So I thought of sharing how to resolve that issue. I hope it will help someone.

Unable to Launch the IIS Express Web Server


In my team we have 5 to 10 members. Since we wanted to do a build for our current application, I used “Get the Latest files from the server”. (We are using TFS.) Then when I run my application I was getting this error.

The cause of this error is, someone has checked in the solution file with his port number (the port number he was using). When I took the latest, it was set in my solution file also. We must take the latest solution file only when it is required. So here I will share the remedy for the preceding issue.

Procedure to solve this issue

Step 1

Right-click on your solution and select Properties as shown in the following figure.


Unable to Launch the IIS Express Web Server


Step 2

Select “Web” from the left menu.


Unable to Launch the IIS Express Web Server


Step 3

Under “Use local IIS server” change the port number from http://localhost:58030/ to another one.


Unable to Launch the IIS Express Web Server


Step 4

Here I have changed http://localhost:58030/ to http://localhost:58031/ .

Bingo! We have done it.


Unable to Launch the IIS Express Web Server


Step 5

Now please run again your application. The issue will be solved.


Did I miss anything that you may think which is needed? Have you ever faced this issue? Does this solution solve your issue?I hope you liked this article. Please share me your valuable suggestions and feedback.

Your turn. What do you think?

A blog isn’t a blog without comments, but do try to stay on topic. If you have a question unrelated to this post, you’re better off posting it on C# Corner, Code Project, Stack Overflow, Asp.Net Forum instead of commenting here. Tweet or email me a link to your question there and I’ll definitely try to help if I am able to.

Kindest Regards
Sibeesh Venu

Unable to launch the IIS Express Web server


I had the exact same problem.
The reason – bad IIS config file.

Try deleting the automatically-created IISExpress folder, which is usually located at %userprofile%/Documents, e.g. C:\Users\[you]\Documents\IISExpress.

Don’t worry, VS should create it again – correctly, this time – once you run your solution again.

EDIT: Command line for deleting the folder:

rmdir /s /q "%userprofile%\Documents\IISExpress"


Beginner’s Guide: How IIS Process ASP.NET Request

[Originally posted by]:


When request come from client to the server a lot of operation is performed before sending response to the client. This is all about how IIS Process the request.  Here I am not going to describe the Page Life Cycle and there events, this article is all about the operation of IIS Level.  Before we start with the actual details, let’s start from the beginning so that each and everyone understand it’s details easily.  Please provide your valuable feedback and suggestion to improve this article.

What is Web Server ?

When we run our ASP.NET Web Application from visual studio IDE, VS Integrated ASP.NET Engine is responsible to execute all kind of requests and responses.  The process name is“WebDev.WebServer.Exe” which actually takw care of all request and response of an web application which is running from Visual Studio IDE.

Now, the name “Web Server” comes into picture when we want to host the application on a centralized location and wanted to access from many locations. Web server is responsible for handle all the requests that are coming from clients, process them and provide the responses.

What is IIS ?

IIS (Internet Information Server) is one of the most powerful web servers from Microsoft that is used to host your ASP.NET Web application. IIS has it’s own ASP.NET Process Engine  to handle the ASP.NET request. So, when a request comes from client to server, IIS takes that request and  process it and send response back to clients.

Request Processing :

Hope, till now it’s clear to you that what is Web server and IIS is and what is the use of them. Now let’s have a look how they do things internally. Before we move ahead, you have to know about two main concepts

1.    Worker Process
2.   Application Pool

Worker Process:  Worker Process (w3wp.exe) runs the ASP.Net application in IIS. This process is responsible to manage all the request and response that are coming from client system.  All the ASP.Net functionality runs under the scope of worker process.  When a request comes to the server from a client worker process is responsible to generate the request and response. In a single word we can say worker process is the heart of ASP.NET Web Application which runs on IIS.
Application Pool: Application pool is the container of worker process.  Application pools is used to separate sets of IIS worker processes that share the same configuration.  Application pools enables a better security, reliability, and availability for any web application.  The worker process serves as the process boundary that separates each application pool so that when one worker process or application is having an issue or recycles, other applications or worker processes are not affected. This makes sure that a particular web application doesn’t not impact other web application as they they are configured into different application pools.

Application Pool with multiple worker process is called “Web Garden”.
Now, I have covered all the basic stuff like Web server, Application Pool, Worker process. Now let’s have look how IIS process the request when a new request comes up from client.
If we look into the IIS 6.0 Architecture, we can divided them into Two Layer

1.    Kernel Mode
2.    User Mode

Now, Kernel mode is introduced with IIS 6.0, which contains the HTTP.SYS.  So whenever a request comes from Client to Server, it will hit HTTP.SYS First.

Now, HTTP.SYS is Responsible for pass the request to particular Application pool. Now here is one question, How HTTP.SYS comes to know where to send the request?  This is not a random pickup. Whenever we creates a new Application Pool, the ID of the Application Pool is being generated and it’s registered with the HTTP.SYS. So whenever HTTP.SYS Received the request from any web application, it checks for the Application Pool and based on the application pool it send the request.

So, this was the first steps of IIS Request Processing.
Till now, Client Requested for some information and request came to the Kernel level of IIS means at HTTP.SYS. HTTP.SYS has been identified the name of the application pool where to send. Now, let’s see how this request moves from HTTP.SYS to Application Pool.

In User Level of IIS, we have Web Admin Services (WAS) which takes the request from HTTP.SYS and pass it to the respective application pool.

When Application pool receive the request, it simply pass the request to worker process (w3wp.exe) . The worker process “w3wp.exe” looks up the URL of the request in order to load the correct ISAPI extension. ISAPI extensions are the IIS way to handle requests for different resources. Once ASP.NET is installed, it installs its own ISAPI extension (aspnet_isapi.dll) and adds the mapping into IIS.
Note : Sometimes if we install IIS after installing, we need to register the extension with IIS using aspnet_regiis command.

When Worker process loads the aspnet_isapi.dll, it start an HTTPRuntime, which is the entry point of an application. HTTPRuntime is a class which calls the ProcessRequest method to start Processing.

When this methods called, a new instance of HTTPContext is been created.  Which is accessible using HTTPContext.Current  Properties. This object still remains alive during life time of object request.  Using HttpContext.Current we can access some other objects like Request, Response, Session etc.

After that HttpRuntime load an HttpApplication object with the help of  HttpApplicationFactoryclass.. Each and every request should pass through the corresponding HTTPModule to reach to HTTPHandler, this list of module are configured by the HTTPApplication.
Now, the concept comes called “HTTPPipeline”. It is called a pipeline because it contains a set of HttpModules ( For Both Web.config and Machine.config level) that intercept the request on its way to the HttpHandler. HTTPModules are classes that have access to the incoming request. We can also create our own HTTPModule if we need to handle anything during upcoming request and response.

HTTP Handlers are the endpoints in the HTTP pipeline. All request that are passing through the HTTPModule should reached to HTTPHandler.  Then  HTTP Handler  generates the output for the requested resource. So, when we requesting for any aspx web pages,   it returns the corresponding HTML output.

All the request now passes from  httpModule to  respective HTTPHandler then method and the ASP.NET Page life cycle starts.  This ends the IIS Request processing and start the ASP.NET Page Lifecycle.


When client request for some information from a web server, request first reaches to HTTP.SYS of IIS. HTTP.SYS then send the request to respective  Application Pool. Application Pool then forward the request to worker process to load the ISAPI Extension which will create an HTTPRuntime Object to Process the request via HTTPModule and HTTPHanlder. After that the ASP.NET Page LifeCycle events starts.

This was just overview of IIS Request Processing to let Beginner’s know how the request get processed in backend.  If you want to learn in details please check the link for Reference and further Study section.

Reference and Further Study


A low-level Look at the ASP.NET Architecture
IIS Architecture

Leveraging MSMQ in ASP.NET Applications

[Originally posted by]:

Leveraging MSMQ in ASP.NET Applications

By Greg Huber

Have you ever developed a Web application that requires extensive processing? Ever had long running Web pages that often time out in the browser? Most Web developers run into these kinds of issues at some point. As Web application requirements evolve, processing and business logic tend to get more complex. Consequently, it is no surprise that Web applications can lead to frustrating Web experiences.

On the other hand, there may also be processes that simply take time no matter how simple or complex the application. At times, there is processing that typically does not lend itself to occur in a Web application.

The above scenarios require an effective way to initiate long running processes so that inherit problems due to the synchronous nature of the Web and long running processes are minimized or avoided all together.


.NET Framework 1.1 (Visual Studio .NET helpful but not required)
Basic familiarity with ASP.NET, .NET Framework
Windows 2000 Professional/Server or Windows XP or 2003 Server

Synchronous vs. Asynchronous Programming Concepts

Before diving into the code, it’s important to understand a few key concepts regarding programming models. Let’s start out with the Synchronous model. In its simplest form, this programming model means that the caller waits until all processing has completed and control is returned.

Alternatively, asynchronous programming means that the caller makes a call and proceeds immediately. A “callback” located in the callers process space may be invoked by the recipient if desired (and available).

The asynchronous concept not only applies to programming models, but also to architectures. Similar to the programming model, a Web application can be architected in such a way that an asynchronous model is achieved. Hence, many of the limitations of the synchronous nature of the Web can be dealt with. In this article, MSMQ will be leveraged to show how to implement such a model.

Overview of MSMQ

MSMQ is the abbreviation for “Microsoft Message Queue”. A queue is simply a message store that is accessible via an API. In .NET, the System.Messaging library is used to interface with an MSMQ.

The primary purpose of MSMQ is to allow for implementing reliable, scalable, high performance distributed applications. Microsoft first released MSMQ with Windows NT 4.0, implemented via COM components. This initial release was fairly complex to deal with in a programmatic fashion. Nevertheless, it introduced many important concepts and benefits, which have been improved upon and carried forward to the current version of MSMQ. Considerable performance gains have also come about since MSMQ 1.0.

For more information, previous version and current features, and support information on MSMQ, etc. please visit the Microsoft MSMQ Center. Also visit the article titled “Accessing Message Queues” for information on reading messages.

Getting Started

The remainder of this article will pose a common scenario, a solution with MSMQ, and walk through the necessary steps to implement the solution.

A Common Scenario

Over time, business requirements evolve, and applications need to be robust enough that they can keep up. Consider the case where a complex calculation evolves to the point where a Web application can no longer process in “Web-time”. In fact, as requirements evolve, data for such a calculation may even come from another system all together, which certainly complicates things.

In other cases, an application you are planning on developing may be a great fit for the Web, with the exception of one or two back-end pieces — for example, generating a report, moving large amounts of data from a data source, etc. These are often activities that Web applications need at some point in time, but due to the lengthy processing time, the Web doesn’t lend itself well.

Unfortunately, there may be little you can do to increase performance / response times in these kinds of scenarios. Often, developers resort to creating a thick-client Windows application that can reside on a desktop-which allows for more control over timeouts. However, many complexities are also introduced, i.e. processing moves from the server to the client and numerous issues may arise including scalability, security, deployment, etc.

One great solution is implementing an asynchronous programming model using MSMQ.

The Proposed Solution: “Disconnected Processing” with MSMQ

At a high level, there are three major logical components. These components may exist on the same machine or could be on completely separate machines.

The ASP.NET client sends a message to the message queue and moves on its merry way. The MSMQ component is a simple message broker; it allows the reading and writing of messages. When a message is read, it is removed from the queue. The .NET service monitors the MSMQ and processes as soon as a message is received. The messages will pile up in the queue until the .NET service is ready to process the next message.

Pre Requisite: Setting up MSMQ

Ensure that you have your Windows 2000/XP CD handy. Simply open the control panel, “add/remove” Windows components, and ensure the Message Queuing Services checkbox is checked. Message queuing must be installed on both the sending (client) and receiving machine (server).

After this step is completed, you will be able to create a private message queue. A private queue is for “workgroup installations”, meaning the computer is not integrated in the Active Directory. There are some limitations that exist in private queues-they are not published whereas public queues are.

Open up the Microsoft Management Console, add/remove the “Computer Management” snap-in, browse to “Services and Applications”, and expand and select the “Message Queuing” node. Right click on “Private Queues” and create a new queue.

Code Walkthrough: Writing a message from the Web

Now that you have set up a private message queue to send and receive messages, you can easily write to it with a Web application. There are a few simple steps to get started. The code for these steps have been included as well-simply unzip to a virtual directory and modify the web.config with your settings.

Important Steps for setting using Messaging in an ASP.NET page

Visual Studio.NET Method Framework Method
Add a reference in your Solution to System.Messaging:
Explicitly add the assembly to your web.config under the :

** Note, you can verify the assembly information by using “gacutil” tool.

Add the line to the top of the class:using System.Messaging; Add the line to the top of the page:<%@ Import Namespace=”System.Messaging” %>

After completing the above steps, your code will be ready to interact with the MSMQ. For demonstration purposes, you can easily create an ASP.NET page with a simple user interface to send a message to a message queue:

This interface shows the two important elements that are necessary for sending messages to an MSMQ-the message queue path and the message itself.

Message Queue Path
A message queue path string must be properly constructed. The syntax of the path can vary widely, depending on the type of queue you are talking to, and where it is located. In the above example, the MSMQ resides on the same machine as the Web server. However, in realistic situations, the MSMQ will reside on another machine. Examples of queue paths:

Queue Type Location message is sent from Example
Public Queue (must belong to ActiveDirectory) Anywhere ServerName\QueueName
Private Queue Same server MSMQ resides on .\private$\QueueName
Private Queue Anyremote location FormatName:DIRECT=OS:machinename\private$\queuename

When using MSMQ with .NET, a message can be any serializable object. When serializing a message to MSMQ, you can use different formatters (including Binary, XML, or even ActiveX which allows for sending COM objects-useful if you want to tap into an existing MSMQ aware application based on COM). You can specify the formatting of your message through the message object that you are sending. For more information on message options, please see the MSDN article on Accessing Message Queues.

In the examples in this article, the default formatter (XML serialization) is used to send a message to the queue, and the message is simply a string object. As mentioned previously, this message could be anything serializable, such as a business object that could then be consumed directly by the listener process.

Code Snippet: Sending a Message

  1. MessageQueue MyMessageQ;
  2. Message MyMessage;
  3. MyMessageQ = new MessageQueue(txtQueuePath.Value);
  4. MyMessage = new Message(txtMessageToSend.Value);
  5. MyMessageQ.Send(MyMessage);
  6. divMessage.InnerHtml= “<b>Message sent
  7. successfully!</b>”;

In this scenario, one important reason for using MSMQ is to provide the capability to separate out lengthy processing from the user. Consequently, after sending a message, the Web page has completed processing and control is returned immediately to the user.

Code Walkthrough: Receiving & Processing a Message

To receive a message with MSMQ in the given scenario, a separate process must be running that is watching the queue. A great way to implement this process is to create a simple .NET service that listens to the queue and processes as soon as a message is sent to it.

Code Snippet: Receiving a message in the .NET service:

	MessageQueue MyMessageQ;
		Message MyMessage;

		MyMessageQ = new MessageQueue(_QueuePath);
		MyMessage = MyMessageQ.Receive;	
		WriteStatus("Message Received!");
		WriteStatus("Processing Finished!");

The “DoSomeLongRunningProcess” method contains code that performs a process that would otherwise cause a timeout if a Web page were running it. Throughout the processing of this method, a database table will be updated (shown later) with status information so at any given point in time, the status of the processing can be determined.

In order to install the service included in the source code, you can simply run the following command after shelling out to the command line:

C:\WINNT\Microsoft.NET\Framework\v1.1.4322\installutil msmqService_listener.exe

Upon successful installation, you will see some informational text scroll by and a confirmation message:

“The Commit phase completed successfully.

The transacted install has completed.”

After installing the listener service, you can open the administrative control panel and browse the current Windows services running on your machine. You should see the service you just installed as pictured below.

After unzipping the service, you will want to ensure that the paths in the MSMQService_Listener.exe.config are correct (instructions are in this file- which is located in the bin directory).

You can now start your service by right clicking “start” and be on your merry way!

Other Considerations

The message queue Receive method waits indefinitely until a message is received on the queue. Depending on the type of processing you are doing, you may want to queue up some worker threads so that multiple messages can be received and processed at once. Consequently, this type of processing can be very robust and scalable.

There are a variety of other methods on the message queue object certainly worth investigating. The following are a few that are noteworthy:

Method Name Description
Peek Performs a non-destructive read a message, meaning the message is not deleted after “peeking”. (Read purges the message)
BeginRead / EndRead, BeginPeak/ End Peak Allows for asynchronous handling of the message. Code will continue running while a message is being received; an event handler will execute when the message has been fully received.
Delete Deletes a message out of the queue.

Code Walkthrough: Checking Status Information

As hinted above, in the scenario where a Web page has triggered a long running process, a user may want status information. One simple technique for providing status information would be to write information (from the .NET service that is doing the processing, as mentioned above) to a database table. The Web application can then check this database table at the request of the user to determine current status.

Database Table

The table above is a simple table that keeps track of a Queue Name and current status. In a real world scenario, you would most likely have more information that you may want to keep track of (such as errors that occurred, information about the message received, etc.). When the listener service receives a message, this status table is updated throughout the processing that occurs.

Code Snippet: Viewing the Table

string dbConnString = 

//Create connection object 
OleDbConnection oCon = new OleDbConnection(dbConnString); 
string sSQL = "Select * FROM QueueStatus ORDER By ID Desc"; 
OleDbCommand oCmd= new OleDbCommand(sSQL, oCon); 

dgStatus.DataSource = oCmd.ExecuteReader(); 

In the source code provided, a Web-based interface reads this table and simply displays the current status. To get the latest status, the user must hit the “show status” button.

Here is a sample view of seeing how the status has progressed:


This article demonstrated a simple technique for handling long running Web processes through the Web via Microsoft MSMQ and the System.Messaging framework. MSMQ is a very useful product that developers should consider leveraging in Web applications.

About the Author

Greg Huber is the President and Founder of the Northwest Ohio .NET Users group ( He is active in the .NET community-speaking at area user groups, serving on the INETA ( user group relations committee, and spearheading community-oriented development initiatives, including Quizzard, a shared-source .NET quiz game. He has been developing and architecting software on the Microsoft platform since 1998, and is currently a lead developer at NFO Worldgroup.