Introduction
ASP Config Tool helps you launch the ASP.NET Configuration website for your ASP.NET projects.
I noticed that in Visual Studio 2013 and 2015 Microsoft (for reasons not yet known to me) seem to have removed the button that lets us launch the ASP.NET Configuration website in the Solution Explorer.
This is a very simple app that seeks to address that issue.
Background
I was refreshing my knowledge on the fundamentals of ASP.NET MVC with a book which was written back in 2011. The sample codes in the book were most likely written in Visual Studio 2010, which I do not have. In a chapter in the book we are directed to click a button on VS solution explorer to launch the ASP.NET Configuration website but I couldn't find it on VS 2015. On doing a little search I discovered that VS 2013 is also missing this button. I did, however, find steps to manually launch the website for a given project. This app is an attempt to take those manual steps and "automate" them for the user.
This is a very simple project. The entire source code is in one file (Form1.cs), and about 400 lines of code only (including empty lines and comments). There are no advanced C# features used in the project, and very few C# 6.0 features (like string interpolation).
Getting Started
System Requirements
- The app was built on a Windows 10 machine, but should run with no modification on Windows 7 and Windows 8.
- The target framework is .NET Framework 4.5.2, but the source code can be built against many previous versions, as well as .NET Framework 4.6. To build it with previous C# versions be sure to replace C# 6.0 string interpolation with alternate methods like the good old string concatenation or String.Format method.
The User Interface
I am assuming you have downloaded the relevant zip files.
- Build and run the solution, this should run the AspWebConfig.exe executable.
- Select your project folder. This is usually the folder where your project's web.config is located, but it also works if you choose the root project folder (although, in that case, you may be asked for username and password).
- Click the Launch ASP.NET Configuration Website button. The app will attempt to launch IIS Express with the appropriate parameters, the app waits 5 seconds, the app then launches the website on your default browser. If the page cannot be loaded, it is probably because IIS Express hasn't finished loading. Wait a few seconds then click the Launch ASP.NET Configuration Website button again. Clicking that button multiple times will not restart IIS Express (except you change something in the Settings tab page) but it will relaunch the website.
- If you are asked for username and password, enter the username and password for the current account you are logged into on your PC.
- If you want more control, the Settings tab page is there for you.
- You can click the Save Settings button to save your preferences. They are saved to an XML file named act-settings.xml in the same directory as the executable.
The Code Behind
To understand how this app works you need to know how the ASP.NET Configuration website is launched manually. There are only two steps involved:
- Start IIS Express with the appropriate parameters. You can do this by running a batch with the contents below:
iisexpress /path:C:\windows\Microsoft.NET\Framework\v4.0.30319\ASP.NETWebAdminFiles /vpath:"/asp.netwebadminfiles" /port:8089 /clr:4.0 /ntlm
- Launch a browser page with the appropriate URL. You can do this by typing the URL below into a browser (replace the variable {project-path} with your actual project path):
This is essentially what the app does when you click the Launch ASP.NET Configuration Website button, except that instead of writing and running a batch file (which is what I did before) I simply use System.Diagnostics.Process.Start method twice: first to start IIS Express, then to launch a browser tab with the appropriate URL.
If you are using VS 2013 or 2015 I hope you find this little project useful.
If you are using VS 2013 or 2015 I hope you find this little project useful.
No comments:
Post a Comment