08.01.2015 Views

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

146<br />

CHAPTER 6 ■ DEPLOYING YOUR WEB SITE<br />

Deploying Your Service Tier<br />

The best way to deploy your application is to use the IDE to deploy it directly to the<br />

server. Visual Studio will perform most if not all of the IIS administration for you if you do.<br />

Before deploying, though, you should once again edit your <strong>Web</strong>.config file. You’ll see<br />

that in the default <strong>Web</strong>.config, this section is commented out. You should remove the<br />

comments:<br />

<br />

<br />

<br />

<br />

These lines configure how your <strong>ASP</strong>.<strong>NET</strong> application will deal with specific errors.<br />

In this case, if the user attempts to access something on your web site they shouldn’t,<br />

<strong>ASP</strong>.<strong>NET</strong> (<strong>and</strong> IIS) will display a “You don’t have access to that resource” error page. If<br />

the resource simply isn’t found, it will display a “File not found” error page. These pages<br />

come as part of <strong>ASP</strong>.<strong>NET</strong>, but feel free to provide your own. Just replace the page file<br />

names you see here with the page file names of the pages you create, <strong>and</strong> <strong>ASP</strong>.<strong>NET</strong> will<br />

use your pages. You can add other error pages as well, following the same model. Just add<br />

the HTTP error code in the statusCode attribute <strong>and</strong> the page file name in the redirect<br />

attribute, as shown here.<br />

Note also that you should ensure that the setting in <strong>Web</strong>.config is set to<br />

turn off debugging, like this:<br />

<br />

<br />

Once the <strong>Web</strong>.config file is ready, you then use the Copy <strong>Web</strong> Site tool on the <strong>Web</strong><br />

Sites menu to access the deployment tool (see Figure 6-18).<br />

At the top of the screen, you’ll see a Connect button. Click this to specify the server<br />

that you want to connect to. One helpful feature is that if you specify an IIS server <strong>and</strong> a<br />

URL containing a subdirectory, IIS will automatically create the virtual web directory for<br />

you. So for example, if you want to deploy the web service to a virtual web directory<br />

called ServiceTier, you simply add it to the URL of the server you want to open <strong>and</strong> then<br />

click New <strong>Web</strong> Site (see Figure 6-19).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!