June 2009 - Posts

July's Toolbox Column Now Online
30 June 09 03:03 PM | Scott Mitchell | with no comments

My Toolbox column in the July 2009 issue of MSDN Magazine is available online and includes the following reviews:

  • ApexSQL Enforce - I've reviewed source code static analysis tools in previous issues, such as Microsoft's FxCop and StyleCop programs. ApexSQL Enforce is a static analysis tool for your database. In a nutshell, it runs a series of rules against a specified database, ranging from security concerns to data modeling.
  • Podcasts of Note: Hanselminutes - in addition to a great blog, Scott Hanselman also hosts a weekly podcast show, Hanselminutes. These roughly 30-minute long shows usually include a guest and focus on a specific development-related topic, like ADO.NET Services, getting started with Domain Driven Design, and an overview of jQuery. These high-quality and educational productions are great material for your daily commute or time at the gym.
  • Terminals - Terminals is a free, open source project that provides a multi tab UI for connecting to remote computers. Terminals supports Terminal Services, Microsoft RDP, VNC, RAS. Telnet, and other protocols and helps consolidate various remote connections into one window. Also included are a number of networking tools, tools for taking and managing screen shots from remote desktops, and one-click access to common administration and network configuration utilities. If you routinely connect to remote computers be sure to check out Terminals.

This issue reviewed Programming Entity Framework, by Julia Lerman. An exerpt from my review follows:

At nearly 800 pages, Programming Entity Framework is fairly hefty, but it offers a solid grounding in using the Entity Framework. The book assumes its readers are intermediate to advanced .NET developers who are already familiar with database concepts, ADO.NET, LINQ, and other core .NET features and spends no time introducing these topics. Instead, the book is packed with walkthroughs that illustrate the use of Entity Framework in various scenarios. It also does a great job pointing out what this first version of the Entity Framework can and cannot do and what use cases are difficult or tricky to implement, along with workarounds where appropriate.

Enjoy! - http://msdn.microsoft.com/en-us/magazine/dd943051.aspx

As always, if you have any suggestions for products, blogs, or books to review for the Toolbox column, please send them to toolsmm@microsoft.com.

Filed under:
Final Six ASP.NET Hosting Tutorials Now Online
19 June 09 07:49 AM | Scott Mitchell | with no comments

The final six tutorials in my Hosting Tutorials on www.asp.net have been published. These tutorials walk readers through hosting an ASP.NET website with a web host provider and are aimed at beginning to intermediate ASP.NET developers interested in getting a small- to medium-sized ASP.NET application online. The first six hosting tutorials served as an introduction to the series and provided an overview of core concepts. These current four tutorials examine deploying a data-driven web application. The following four tutorials explored common challenges in deploying data-driven web applications. These final six tutorials look at handling and logging runtime errors in the production environment as well as site administration and advanced deployment options.

  • Displaying a Custom Error Page [VB | C#] - What does the user see when a runtime error occurs in an ASP.NET web application? The answer depends on how the website's <customErrors> configuration. By default, users are shown an unsightly yellow screen proclaiming that a runtime error has occurred. This tutorial shows how to customize these settings to display an aesthetically-pleasing custom error page that matches your site's look and feel.
  • Processing Unhandled Exceptions [VB | C#] - When a runtime error occurs on a web application in production it is important to notify a developer and to log the error so that it may be diagnosed at a later point in time. This tutorial provides an overview of how ASP.NET processes runtime errors and looks at one way to have custom code execute whenever an unhandled exception bubbles up to the ASP.NET runtime.
  • Logging Error Details with ASP.NET Health Monitoring [VB | C#] - Microsoft's health monitoring system provides an easy and customizable way to log various web events, including unhandled exceptions. This tutorial walks through setting up the health monitoring system to log unhandled exceptions to a database and to notify developers via an e-mail message.
  • Logging Error Details with ELMAH [VB | C#] - Error Logging Modules And Handlers (ELMAH) offers another approach to logging runtime errors in a production environment. ELMAH is a free, open source error logging library that includes features like error filtering and the ability to view the error log from a web page, as an RSS feed, or to download it as a comma-delimited file. This tutorial walks through downloading and configuring ELMAH.
  • Precompiling Your Website [VB | C#] - Visual Studio offers ASP.NET developers two types of projects: Web Application Projects (WAPs) and Web Site Projects (WSPs). One of the key differences between the two project types is that WAPs must have the code explicitly compiled prior to deployment whereas the code in a WSP can be automatically compiled on the web server. However, it is possible to precompile a WSP prior to deployment. This tutorial explores the benefits of precompilation and shows how to precompile a website from within Visual Studio and from the command line.
  • Managing Users and Roles On The Production Website [VB | C#] - The ASP.NET Website Administration Tool (WSAT) provides a web-based user interface for configuring Membership and Roles settings and for creating, editing, and deleting users and roles. Unfortunately, the WSAT only works when visited from localhost, meaning that you cannot reach the production website's Administration Tool through your browser. The good news is that there are workarounds that make it possible to manage users and roles on production. This tutorial looks at these workarounds and others.
As with the previous 10 tutorials in this series, each tutorial can be downloaded as a PDF for offline viewing or printing and each tutorial includes a working website that illustrates the concepts discussed in the tutorial (and can be downloaded as a ZIP file).


-- Hosting Tutorials Homepage: http://www.asp.net/learn/hosting/
-- ASP.NET Vidoes, Tutorials, and Other Learning Material - http://www.asp.net/learn/

Filed under:
Installing the FTP Service for IIS 6.0 On An Alternate Port Number and Configuring Windows Firewall
17 June 09 04:01 PM | Scott Mitchell | with no comments

The Scenario
You need to setup the Windows FTP service that is part of IIS 6.0 on a port number other than the standard port 21 and are using Windows Firewall on the server.

The Challenge
Getting an FTP server and the firewall to play nicely can be a bit of an adventure because FTP uses two ports for communicating - one for establishing the connection (typically port 21) and another one for transferring the data. I believe that the FTP service for IIS 6.0 uses port 20 as the data port when using port 21 as the connection port, but I am not 100% certain. What I am certain of is that the data port may be randomly selected from a wide range of ports, and that is certainly the case when you select an alternate port number for the FTP service. The challenge lies in configuring the firewall to accept incoming requests to both the alternate port and the randomly selected data port.

If neither port is opened in the firewall then when you attempt to connect to the FTP server the client will hang and eventually report that it cannot connect. If only the connection port is open then the FTP client will connect successfully but will repor the error: Failed to retrieve directory listing. The reason is because the connection can be established over the connection port, but the request made to the data port to get the directory listing was blocked by the firewall. Long story short, you need to make sure that the firewall will allow traffic for the randomly selected data port.

The Solution

  1. Create an FTP site on the port number of choice, such as 12345. Typically you'll want to use a high port number to minimize the likelihood of a conflict. See Creating Multiple FTP Site (IIS 6.0) for more information on how to create multiple FTP sites using multiple ports.
  2. If you are using Windows Vista or Windows 2008 as the server, run the following command from the command line: sc sidtype MSFTPSVC unrestricted
  3. Stop and restart the FTP service.
    • Note: I got an error when restarting the service that complained that an unrestricted service could not be started in the same host as restricted services. I'm sure there is a more elegant workaround, but what worked for me was to reboot the server.
  4. Configure Windows Firewall to allow all TCP traffic in for the MSFTPSVC service. This will allow traffic on the randomly selected data port to penetrate the firewall. You can do this from the Windows Firewall configuration GUI or from the command line via: netsh advfirewall firewall add rule name="FTP" service=MSFTPSVC action=allow protocol=TCP dir=in
  5. Ensure that the FTP filter for Windows Firewall is disabled. You can do this via the command line, as well: netsh advfirewall set global Statefulftp disable

For more on Steps 2-5 see Windows Firewall Setup for Microsoft FTP Publishing Service for IIS 7.0. Some of the command line arguments are different in the article than what I have posted above because my commands are for the FTP Service that's part of IIS 6.0 whereas the article linked to looks at using the FTP Publishing Service for IIS 7.0.

I spent the better part of an afternoon figuring out these five steps. I hope this blog entry saves someone else a few precious hours.

Filed under:
More Posts


My Books

  • Teach Yourself ASP.NET 4 in 24 Hours
  • Teach Yourself ASP.NET 3.5 in 24 Hours
  • Teach Yourself ASP.NET 2.0 in 24 Hours
  • ASP.NET Data Web Controls Kick Start
  • ASP.NET: Tips, Tutorials, and Code
  • Designing Active Server Pages
  • Teach Yourself Active Server Pages 3.0 in 21 Days

I am a Microsoft MVP for ASP.NET.

I am an ASPInsider.