Showing posts with label IIS. Show all posts
Showing posts with label IIS. Show all posts

Wednesday, 18 November 2009

Smtp4dev

Ever had to setup a local SMTP server when you’re developing some functionality but don’t want the emails being sent out by accident?

I’ve had a couple of systems which I’ve written over the years and been a little paranoid each time that some test emails will be sent out to a live email address. This stems from a project I worked on a while back and had to send the system to the company development team so they could do some in depth testing/debugging and they ended up sending over thousand emails out to the client ;-)

Any how …

I went to setup an SMTP server locally to do some testing today and found out that Windows 7 doesn’t have a built in SMTP server option anymore so went on a Google hunt. After doing some searching I came across a few free server options, but the one which caught my eye was on Codeplex. My initial thought was “Woo, can see how they wrote it if I want to” and the description was spot on …

Project Description
Dummy SMTP server that sits in the system tray and does not deliver the received messages. The received messages can be quickly viewed, saved and the source/structure inspected. Useful for testing/debugging software that generates email.

Anyway, I downloaded the latest build of smtp4dev as it seemed to fill all my requirements; a) does not deliver email and b) doesn’t interfere with anything else. 

The description was spot on, and so far so good it works as required. Will post an update once have used it a bit more.

Hope it helps others out in the future. Let me know if this helps you!

Tuesday, 27 October 2009

Visual Studio 2008 + IIS 7 development

At my new job part of my role is to bring most of the current website development in house for the 8 websites we currently have. Due to this I have decided to instead of just run them on the built in development web server which ships with Visual Studio and launches when you hit f5 with an address something similar to http://localhost:58697/Website1 to setup individual websites in IIS to best replicate the production environment. This is possible as IIS 7 on Windows 7 allows multiple websites on the client OS.

To do this I did the following:

1. Create a new website in iis 7 manager console; setting the host name to <identifier>.localhost

image

2. Update the hosts file to point the local loop back ip address to know about this new host name. Open the hosts file found in C:\windows\system32\drivers\etc\ and add the following line:

127.0.0.1                         website1.localhost

3. Open the Visual Studio solution (as Administrator) with the website in and navigate to the property page of the website. Navigate to Start Options > Server > Use custom server and set the Base Url to http://website1.localhost

image

4. Hit f5 in Visual Studio and run it.

I hope this helps anyone looking to do a similar thing.

Enjoy :-)