Wednesday, December 15, 2010

Install IIS 7.5 on Windows 7

Here are the quick steps for installing IIS 7.5 on Windows 7 Professional/Enterprise/Ultimate. While Microsoft’s TechNet does have an entry it’s not the most informative or person-friendly (person being different than a techie geek). This post is a companion to the How To series on building a 2-tier ASP.NET 4.0 web site (part 1, part 2, part 3).

  1. Navigate to Control Panel | Programs | Turn Windows features on or off:
    2010-12-01_223350
    2010-12-01_223854
    2010-12-01_223914
  2. Check the box next to Internet Information Services and then expand the sub-tree by clicking the (+) plus sign next to it:
    2010-12-01_223942
  3. Continue expanding the sub-tree until you open Application Development Features then check the box for ASP.NET:
    2010-12-01_224027
  4. Further down, expand Security then enable Basic Authentication and Windows Authentication:
    2010-12-01_224124
    2010-12-01_224136
    Clicking OK to close the dialog out will cause the computer to install and pre-configure IIS, taking several minutes to complete.
  5. After IIS is installed you’ll find a new set of folders has been created:
    2010-12-01_225259
    C:\inetpub\wwwroot is the default “root” folder for IIS (a.k.a. world wide web server) so this path is the default location to place websites. The key fact here is that if you publish into this folder you won’t have to worry about folder (NTFS) permissions. Publishing to the default personal user location that Visual Studio selects – within your “My Documents” folder means you need to take an extra step of granting IIS permission to access those folders in your documents area. This screenshot from IIS Manager shows the default web site along with the path matching the path shown above:
    2010-12-01_230027
  6. Next we’ll configure Application Pools that will host and execute the ASP.NET applications. Launch IIS Manager from Control Panel | Administrative Tools | Internet Information Services (IIS) Manager:
    2010-12-01_225342
    2010-12-01_225416
    Hint: IIS Manager is the configuration tool for IIS and you’ll be jumping into it often. You can use the Run dialog for faster access via the Windows + R then typing “inetmgr”:
    2010-12-01_225504
  7. When you select the Application Pools entry in the tree control you should see the following:
    2010-12-01_225613
    However, a standard configuration of IIS 7.x on Windows Server 2008 R2 looks like this:
    2010-12-01_225822
    Notice that the server installation contains two additional application pools configured for ASP.NET v4.0.
  8. Let’s configure our personal machine (desktop/laptop) in the same manner to enable more realistic local testing. Right-click on the Application Pools entry in the tree control and choose Add Application Pool:
    2010-12-01_225857
    After adding the integrated mode, repeat the steps to add a classic mode pipeline:
    2010-12-01_225931
  9. Since IIS was not installed and ASP.NET was already present in Windows 7, we must manually register the “handler” for ASP.NET pages and content so IIS can correctly map web requests. To do so open a command prompt running as Administrator – necessary because this type of registration requires elevated permissions. To open a command prompt as Administrator click the Start button, type in “command” and wait a moment until it shows the Command Prompt under the Programs section then right-click and select Run as administrator as shown here:
    2010-12-01_234807
  10. With the command prompt open execute two commands by typing in each of the following and pressing Enter after each command:
    2010-12-01_235058

    cd  %windir%\Microsoft.NET\Framework\v4.0.*
    aspnet_regiis.exe –i

    Note that the last four digits of the build number (30319 shown above) are less important. You may have a different version depending on the service pack level and patches installed in your computer.

That’s it – you’ve installed IIS, enabled common security features and created application pools designed to host ASP.NET 4.0 websites.

Monday, December 13, 2010

How To Build a 2-Tier ASP.NET 4.0 Web Site–Part 2

Last time we built a new ASP.NET 4.0 empty web site and set up the Default.aspx web form with a simple prompt for customer number. Now we’ll create a Result.aspx to display the results of a query from the AdventureWorks sample database. Don’t be alarmed at the length of this part, I simply took lots of screenshots along the way to make it easy to follow.
  1. Add a new page named Result.aspx as described previously in step 3:
    2010-12-01_231902
  2. Switch the content area to “split” view using the tabs at the bottom, located the GridView control in the toolbox and drag it onto the design surface:
    2010-12-01_231937
  3. To configure the data source click on the small arrowhead in the upper right section of the grid view control to expose the configuration pane as shown here:
    2010-12-01_232004
  4. Click the drop-down control next to “Choose Data Source:” above and select “<New data source…>” which will launch the Data Source Configuration Wizard:
    2010-12-01_232044
    As shown above, select the SQL Database icon and input a meaningful name (or accept the default).
  5. Clicking “OK” will bring up the next dialog to choose a database connection where you’ll select the New Connection button:
    2010-12-01_232107
  6. In the Add Connection dialog specify the name of the SQL server – this can be (local) if SQL (or SQL Express) is installed on the same machine you’re working on or another machine:
    2010-12-01_232132
    For (local) machines you should be able to the leave the Log on to the server default as Use Windows Authentication. For remote machines you might have to switch to Use SQL Server Authentication and supply a user name / password combination – unless your machine is part of a Windows domain as is usually the case in corporate environments. The selected database name should be AdventureWorksDW2008 or AdventureWorksDW2008R2 depending on which version you installed.
  7. Press the Test Connection button to verify that these settings work. If the test fails seek help or otherwise resolve the problem before continuing.
    2010-12-01_232206
  8. Save the Connection string and continue:
    2010-12-01_232243
  9. Choose the DimCustomer table for the Select statement:
    2010-12-01_232304
  10. Choose FirstName, MiddleName, LastName, BirthDate, Gender, and Phone for columns and click the WHERE… button:
    2010-12-01_232340
  11. Select the CustomerKey as the Column name to filter on, specify Form as the source (i.e. use Request.Form collection value) then type the name previously used as the ID for the Textbox control in step 5:
    2010-12-01_232408
  12. After clicking the Add button you’ll see the WHERE clause that has been constructed and you can click Test Query to verify that the SELECT statement executes properly as expected:
    2010-12-01_232425
    2010-12-01_232444
    2010-12-01_232456
    2010-12-01_232508
  13. After clicking the Add button you’ll see the WHERE clause that has been constructed and you can click Test Query to verify that the SELECT statement executes properly as expected:
    2010-12-01_232531
  14. Save your work then move back to Default.aspx to wire the Submit button to post back to the new Result.aspx page:
    2010-12-01_232823
    Clicking the ellipsis next to the PostBackUrl brings up a list of pages within the project where you can select Result.aspx:
    2010-12-01_232832
  15. Right-click on Default.aspx in Solution Explorer and set it as the start page:
    2010-12-01_232659
  16. Finally, hit “F5” to test the site:
    2010-12-01_232735
    2010-12-01_232859

Note the following:

  • The port number shown above (:1483) will be different – Visual Studio generates a random port number for each web project.
  • Visual Studio contains (hosts) a built-in “mini” web server functionally identical to the full-blown web server IIS (Internet Information Server). However, this server is restricted to a minimum number of browser connections and can only be accessed via a web browser on the same machine Visual Studio is on.



At this point we’ve got a working 2-tier ASP.NET 4.0 web site that’s prompting for a customer, querying a SQL database and displaying the results in a grid (tabular) format. Next we’ll setup IIS 7.5 on Windows 7 then deploy the site out to a commercial web server.

Thursday, December 9, 2010

How To Build a 2-Tier ASP.NET 4.0 Web Site–Part 1

Recently I needed to document cookbook steps for quickly creating a simple 2-tier web site in ASP.NET 4.0. In case this helps someone else, here the are.
Environment:
  • Windows 7 Business/Enterprise/Ultimate (Home & Home Premium should work)
  • Visual Studio 2010 Professional/Premium/Ultimate
  • IIS 7.5
  1. Launch Visual Studio 2010 then create a new website project (File | New | Web Site):
    2010-12-01_223350
  2. Ensure that Visual C# is chosen under Installed Templates on the left, that .NET Framework 4 is chosen in the drop-down and then pick ASP.NET Empty Web Site:
    2010-12-01_230242
    Hint: Note the path of the Web location as you will need it later on when deploying to IIS.
  3. Add a new Web Form page by right-clicking on the project entry in Solution Explorer and choosing Add New Item. If the Solution Explorer is not visible, use View | Solution Explorer or Ctrl + W then S to display it:
    2010-12-01_230856
    Notice that the 2nd entry in the tree view on the left is highlighted, the pop-up context menu will be different depending on which item you right-click on. The 1st entry is called the “solution” which is a container of sorts that can contain one or more projects.

    As before, ensure that Visual C# is chosen under Installed Templates and pick Web Form:
    2010-12-01_230930
    Leave the defaults at the bottom of the dialog as shown above.
  4. Switch to “split” view in the designer panel to more easily see the effect of your actions. Open the toolbox to the “Standard” section (if the Toolbox is not visible, use View | Toolbox or Ctrl + W then X to display it) then drag ‘n drop a label control onto the designer portion of the form as shown here:
    2010-12-01_231227
    Notice the lower “Design” pane show the visual design surface while the upper “Source” view shows the underlying code created in response to dragging and dropping the control. Update the label text as shown here:
    2010-12-01_231306
  5. Repeat the same process to add a Textbox following the label:
    2010-12-01_231329
    Resulting in the following:
    2010-12-01_231628
    Note the default ID of the control: TextBox1. Change it to something more meaningful such as txtCustomerId.
  6. Repeat the process a 3rd time adding a Button control:
    2010-12-01_231757
    Change the text label of the button to Submit.
That’s enough for today. Stay tuned.

Monday, November 8, 2010

MacBook Pro reflections

It’s been almost two months since I switch my work machine to a MacBook Pro. I’ve been asked a few times what I thought after having used it for a while. Honestly, I’ve got mixed feelings. First the pros:

  • Ergonomics – the hardware is very nice. The size and feel of the aluminum uni-body is great. There’s lots of little touches like the auto-dimming and the track pad. I’ve even found myself trying to use two- and three-finger gestures on a PC touch pad when I happen to use one.
  • The general thoughtfulness that goes into features like the widgets, Finder, and overall ease of use

However, there are still things that I don’t like or agree with:

  • Insistence on a single-button mouse. Even after using a Magic Mouse for a while I still find that my two button, scroll wheel PC mouse is much more useful – perhaps it comes from almost two decades of using a PC-style mouse.
  • Lack of consistency in keyboard shortcuts. Generally the basic keys like Command+A, Command+C work okay but apps tend to be different enough that it’s annoying. Sometimes its Control+ and other times its Command+.
  • Price.

I just priced out a full Dell XPS 17 with upgraded bells ‘n whistles and still came in at $2K while the MacBook Pro is $3K loaded. That’s a full 50% premium above a high-end PC! I’m also finding that it is…well, a machine – a computer. I can be productive and useful with either one but I just don’t get the rabid fan boy, bash a PC whenever possible, pry-it-out-of-my-cold-dead-fingers feeling. Now, I’m not a graphics designer – just a corporate business user so I have Office 201x on both the Mac and Windows 7 as well as the same browsers, chat programs, and pretty similar utilities.

Saturday, October 16, 2010

MacPorts - a slick system for easily installing OSS

It's been a month since I moved from a Windows-based laptop to a MacBook Pro and I'm just now getting around to playing with development toys..err, tools. First order of business was to grab Ant and Maven. Knowing that OS X is built around Linux meant it should be pretty easy. Of course, nothing ever is and it turns out there's lots of advice going back several years in the 'Verse. After seeing several references to MacPorts (formerly DarwinPorts) I checked it out. In a matter of minutes I had the two projects installed, configured and running.

Want to install Tomcat? It's as simple as...
$ port list tomcat*
tomcat-native  @1.1.20  java/tomcat-native
tomcat5        @5.5.25  java/tomcat5
tomcat6        @6.0.29  java/tomcat6


sudo port install tomcat6

Voila. There's 7,434 ports available at this time.

Powered by Qumana

Thursday, September 23, 2010

Cross-Platform Developer's Tools Comparison

One of the first things with moving to or even evaluating a new platform is figuring out what is "there" on the target OS. This answers the question "What can I still do" or better yet "How do I...".  Here's my comparison list of tools across Linux, OS X, and Windows. Yes, I know that OSX is Linux under the covers, however it is enough of a "standoff-ish" platform (IMHO) with regards to user experience, development platform/tools (used to build the software I'm talking about), etc. that I categorize it separately.

Tool Linux OSX Windows
Blog Writer Qumana Live Writer
Database Tool DbVisualizer DbVisualizer DbVisualizer
SQL Server Management Studio Express
Development IDE Eclipse
MonoDevelop
Eclipse
MonoDevelop
Eclipse
SharpDevelop
Visual Studio
File Compression 7-Zip 7zX 7-Zip
File/Folder Comparison Beyond Compare Delta Walker Beyond Compare
Instant Messaging Pidgin Adium Pidgin Pidgin
Source Control Subclipse Subclipse
Versions
AnkhSVN
TortoiseSVN
System Tray Status/Tools iStat Menus SysInternals
Text Editor Beyond Compare Text Wrangler Notepad++
Video Player VLC Player VLC Player VLC Player
XML Editor <oXygen> <oXygen> <oXygen>

Note that this list is what I've found for software that is comparable and gets the job done for me.
Tags: , , ,



Powered by Qumana

Wednesday, September 22, 2010

Thoughts on moving from Windows to Mac

This past weekend I migrated my laptop world from Windows to Mac OS X. As I'm bring apps and data over I'm discovering things that I didn't expect and having difficulty finding things...

  1. Keyboard navigation - the home, end, and paging (up/down) keys are missing. Paging is the most missed as I do more browsing, reading and searching than I do filling out forms. I suspect that only a subset of PC users actually use these keys - probably those of us who are more technically proficient. This leads to my first observation: applications that automatically select all text in a field (name, address bar, etc.) are appreciated. Firefox and Chrome do this but Safari and "native" Mac programs don't seem to which makes me think it's either a philosophical difference or perhaps there's a shortcut keystroke I haven't discovered.
  2. Menus and system tray along the top. I know that both OSes can be tweaked and customized but I tend to keep the customizations "down". I learned long ago that you can make your whole computing world "just so" only to go to another machine and be lost because it's not your machine. I like the tray in the upper right of the screen as it's more at eye level. I didn't realize this until the Mac when I realized I wasn't crouching over and squinting down in the corner to see the icons and the context menus. Of course, that's also a hazard of age and tired eyesight. I'm still finding that I'm looking for the application menu at the top of the window rather than the top of the screen.

Tags:

Powered by Qumana