Wednesday, March 16, 2011

Windows Authentication using local developer server

I'm developing an ASP.NET application which needs Windows Authentication. I have the web.config set up to deny anonymous users and use Windows mode for authentication, but my local development version still lets me pass right through to the site. In order to test different user set-ups, I need to force authorization so I can change users.
How do I set up my system (config files, VS2005 settings, IIS, etc?) to force the authorization window to popup on the site when I'm running on local asp.net development server? In other words, how do I get the authentication popup when running the site in Debug mode?

You will also need to configure IIS and have your application point to IIS instead of the local web server
To configure Windows authentication
  1. Start Internet Information Services (IIS).
  2. Right-click your application's virtual directory, and then click Properties.
  3. Click the Directory Security tab.
  4. Under Anonymous access and authentication control, click Edit.
  5. Make sure the Anonymous access check box is not selected and that Integrated Windows > authentication is the only selected check box.
http://msdn.microsoft.com/en-us/library/ms998358.aspx
To configure your application to point to IIS
  1. Right click on your web project, and then click Properties
  2. Click the Web tab
  3. Click the "Use Local IIS Web Server" radio button

Things on the Development server

  • A web server
  • A script to migrate from dev to test
  • A script to migrate test to production
  • a script to backup your svn to S3 or similar offsite backup storage
  • a good text editor
  • sed, awk and ruby for the really hard scripts
  • postmortem debugging tools, for Windows that is:
    • umdh (for memory leaks)
    • drwtsn32 (for crashes),
    • cdb (to get minidumps from hung apps),
    • windbg (to inspect the minidumps).

set up a team development testing environment

Ideal for Microsoft Technologies is TFS (Team Foundation Server), which has all the features you want.
In case you don't want TFS, try this:
Version control system
Bug Database / Project Management / Tasks
Developers environment
  • Dual screen
  • Powerful PC
  • Quality chair
  • Whiteboard
  • Free coffee

Development machine: Visual Studio  + VisualSVN/TortoiseSVN + Resharper
Buildserver: Teamcity
LAN testing server: Webserver with build by buildserver + DB with daily copy of live
QA/Staging depends on the project size.

Friday, March 4, 2011

Install IIS WMSvc

The default IIS 7 installation options do not include the Management Service (also referred to as the Web Management Service (WMSVC)), which is required for remote administration. If you have not installed the Management Service, follow the steps in this procedure to install it.
To install the Management Service:
  1. Click Start, type Server Manager in the Search box, and press ENTER to open Server Manager.
  2. In the tree, under Roles, select Web Server (IIS).
  3. Click Add role services, and then select Management Service as shown in the image below.
  4. Click Next and follow the instructions to complete the installation.

Publishing your website to a remote server

"I have always felt that publishing a site so it works on your remote server is a little bit of a black art. Many stars have to align:
  1. Files and databases have to transfer
  2. Settings such as connection strings have to transform to remote values
  3. Remote server has to be configured properly e.g. must have all dependencies installed
WebMatrix makes no. 1 and 2 significantly easier – it includes support for Web Deploy, FTP and FTPS protocols to transfer content. Second, if you are using Web Deploy, settings are automatically transformed so they work on the remote server. Still, things can go wrong … here are the most common publishing errors and solutions for them:

Error: “The application pool that you are trying to use has the 'managedRuntimeVersion' property set to 'v2.0'. This application requires 'v4.0'.”

Solution: An application pool provides isolation for websites. Typically, web hosting providers create one application pool per website, and set default values for a number of attributes. One of these attributes is the version of the .NET framework. The user can often change this value between .NET 2.0 and .NET 4.0 through the web hosting provider’s control panel. You will see this error during publishing if you are publishing an ASP.NET Web Pages application, which requires .NET 4.0, to a hoster who has given you a website with a .NET 2.0 application pool. Similarly, you will see this error if you are publishing an application that requires .NET 2.0 to a website associated with an .NET 4.0 application pool. The solution is to set the .NET framework version in the web hosting provider’s control panel or, if there are no compatibility issues, change your application’s .NET framework version in WebMatrix’s Settings workspace.

Error: “Username or password incorrect” error when using Web Deploy

Solution: This is probably because the value in Site Name is incorrect. Site Name must contain the name of the IIS site on the remote server. Typically, it matches your domain name, but it doesn’t have to. For example, it can be “Default Web Site” (if you have a dedicated server) or “foo” or “foo.com”. Web Deploy must authenticate to the site before it can execute any providers.

Error: Web management service not started on destination

Solution: You may see this error if you are deploying to a server you have set up yourself. Web Deploy requires a service called Web Management Service (wmsvc) to be running on the remote server. You can get this error if the service is not started. This blog post is a good starting point to learn how to configure a remote server with Web Deploy and wmsvc.

Error: Failed to invoke provider “iisApp”

Solution: Under the covers, WebMatrix users Web Deploy’s iisApp provider to sync files and directories, and to mark folders as applications. You may see this error if delegation rules are not configured correctly on the remote server. Delegation rules allow the user to execute some actions that require administrative privileges, such as marking a folder as an application. This blog post and this one gives good information on how to configure delegation rules.

Error: Bad gateway: check proxy settings

Solution: This one is literally what it says – check proxy settings because Web Deploy traffic is being blocked. Try installing your corporation’s required firewall client, and disabling all settings in Internet Explorer > Tools > Options > Connections > LAN settings.
 "

Wednesday, March 2, 2011

Breadcumb links for web

Use JavaScript to read where your page is in the site folder structure and build back links to the pages higher up in the hierarchy. If you're trying to add breadcrumb links to PHP pages, you might try our PHP breadcumb links script instead.

Download the .zip archive of the script from: MPBackLinks.js
There are a few variables near the top of the MPBackLinks.js file that you can also customize to better control the appearance and behavior.
Using the Script in HTML
<script type="text/javascript" src="MPBackLinks.js"></script>
You can customize the styling of your menu using CSS. The menu is created inside a
with a class assigned named "mp_backlinks". You can create a new CSS class sytle named "mp_backlinks" and assign whatever style settings you want.