INTRODUCTION

If you haven’t already started planning your migration from a Windows Server 2003 environment, then I recommend you get started. As of July 14, 2015, extended support for this operating system and the associated components (that is, IIS 6) will stop. This means that Microsoft will no longer create security updates or take support calls for this version.

Whether you’re almost finished with your migration or just beginning, you shouldn’t underestimate the importance of choosing your next platform. You may want to upgrade to the most current versions of all the components necessary to run your system while keeping the number of required changes to a minimum. You might even want to get venturesome and convert some of your ADO.NET queries to use LINQ, implement an ORM, or migrate from Oracle to SQL Server.

You have many reasons to upgrade to the newest operating system:

  • It’s a good opportunity to not only change platforms, but also to reinvent your system.
  • You can look at your system from an opportunity perspective instead of from a cost perspective.
  • You can find fresh innovations now available on these new platforms, and gain additional customers while retaining your key talent.
  • In addition to innovating, you can take a closer look at support and maintenance cost reduction opportunities on these new platforms. You may get a pleasant surprise.

As exciting as this may sound, you can anticipate significant effort and some risk when you move to an entirely new platform. You should make these changes in phases; for example, deploy the system “as-is” to the platform and then migrate to the new framework or DBMS system one after another. It is recommended that you make as few changes as possible at a time making it easier to troubleshoot any problems that arise. Understanding the requirements of your system and the capabilities of the new environment are key factors in a successful migration.

WHO THIS BOOK IS FOR

This book is for technology professionals looking to take advantage of the functionality that ASP.NET MVC 4 and Windows Azure Cloud Services offers. You should already have a good understanding of ASP.NET, ADO.NET, NHibernate, and IIS.

WHAT THIS BOOK COVERS

This book explains some of these new capabilities and walks you through a real-world migration of an ASP.NET 2.0/ADO.NET website hosted on Windows Server 2003 using IIS 6 to an ASP.NET MVC/ORM (NHibernate) website-hosted on Windows Azure.

HOW THIS BOOK IS STRUCTURED

This book is organized into four sections:

  • Migration
  • Enhancing
  • Deployment
  • Monitoring and Troubleshooting

Each section contains two chapters. The first chapter of each section contains concepts you need to understand about the migration process. These include, for example, what you need to know to migrate from ADO.NET to an ORM like NHibernate, to understand the Entity Framework, or to determine the major differences between ASP.NET and ASP.NET MVC. The second chapter contains detailed exercises of the most interesting modifications made between the old and new versions of the technology. These step-by-step instructions are intended to give you a deeper understanding of the migration process so you can reproduce the migration, if required.

If, while performing steps in an exercise chapter, you find that you don’t understand the reasoning behind them, you can always click the section’s hyperlink, attached to the exercise heading, to access the appropriate discussion in concept chapter.

Migration

Rather than use “Migration” for the name of this section, “Transformation” might have been used. The differences between ASP.NET and ASP.NET MVC are big enough to say that this is not only a change in technology, but also a change in some fundamental concepts that impact design, testing, and maintenance decisions. The way you previously worked with web forms in those capacities must be tweaked to fit into this new technical framework. Not only do you learn about those differences in this section, but you also discover how to migrate from ADO.NET to NHibernate, Team Foundation Server, and Test Driven Development, all of which are conceptual changes if you haven’t previously used them.

In addition, an introduction to Windows Azure and some of the concepts features available are discussed in this section. This introduction prepares you for the deeper analysis covered in the chapters that follow.

Enhancing

Performance matters a great deal. For systems that get millions of hits per day, a system can gain a lot of opportunity even when the improvement is less than one-half or one-quarter of a second. For example, if a Facebook page responded 500 ms faster than it does now, this would result in a three percent increase in traffic.

The more recent versions of ASP.NET and the .NET Framework have seen some significant advancement in the available features for optimization, for example, minification, bundling, compression, and caching. Using tools such as ACT, Google PageSpeed, or F12 Developer Tool Suite that measure the speed of your system and provide some tips on how to improve performance are valuable. A test website, available for download on the Wrox website here www.wrox.com/go/azureaspmvcmigration, serves as an example for testing these tools and viewing the results of implementing the author’s suggestions. The sample ASP.NET website is located at http://aspnet.thebestcsharpprogrammerintheworld.com; the sample ASP.NET MVC 4 Windows Azure Web Site (currently in Preview mode, that is, beta) is located here at http://mvc-4.azurewebsites.net; and the sample ASP.NET MVC 4 Windows Azure Web Role is located at http://mvc-4.cloudapp.net.


WARNING Windows Azure Web Sites are currently in Preview mode. All references to this feature are subject to change.

Finally, some tips and discussion about how to scale on a Windows Azure program are provided.

Deployment

Moving your source code between your different testing environments requires a clearly defined process and, in many cases, a partially or fully dedicated Release Manager. Keeping the database connections, resource dependencies, source code, operating system version/patches, system configuration, and so on identical between environments can be a daunting task. It is a daunting task because to do it well the Release Manager must make sure system testing, integration testing, and production servers are identical so that results from testing are the same on all environments. If there are differences between servers, the behavior of the system may be different.

One of the benefits of the Windows Azure Cloud Service is its Staging and Production environments, which enable you to deploy your source code to the cloud and test it without impacting or changing your production/live system. This a very valuable benefit, and reduces the risks that come with making changes to a production system. When testing is complete, you can switch your Staging environment to become the Production instance on the Widows Azure platform.

You have many ways to move your code from a local location to a website or Cloud Service hosted on the Windows Azure platform. For example, you can link your website or Cloud Service directly to Team Foundation Server by selecting the Set Up TFS Publishing link on the Dashboard for the given website or Cloud Service. You can also publish from within Visual Studio, using Web Deploy, or by using an FTP application such as FileZilla or WS_FTP.

Monitoring and Troubleshooting

Just because business owners signed off on your website and it is deployed to a live environment, that doesn’t mean your work is complete. At this point, some of the most complex and challenging aspects of technology start. There is no tool nor person who can test or code for every user behavior and action occurring within your application. Therefore, you need to be ready to troubleshoot and resolve issues for which you have not planned. For example, the following happens only in the Production environment: The performance of a transaction is very slow, logging in to the system results in a timeout or the execution of a report results in a time out.

You have a number of monitoring and supportability options available on the Windows Azure platform. These include the Windows Azure management console, Dashboard, which shows the CPU and Memory utilization of your website or Web Role. You can also configure and download IIS logs and Failed Request Tracing logs for offline analysis.

You also have the capability for Remote Desktop Connection to a Web Role/Cloud Service. By employing this, you can access the IIS Management console, which enables you to configure, monitor, and optimize the IIS configuration. The Remote Desktop Connection enables you to access tools, such as Task Manager, Event Viewer, and Performance Monitor to gain a deeper understanding of how your website performs.

WHAT YOU NEED TO USE THIS BOOK

To run the samples in the book, you need the following:

  • Microsoft Visual Studio 2012 Express or Professional
  • Microsoft SQL Server 2012
  • NHibernate 3.3
  • A Windows Azure Account

The source code for the samples is available for download from the Wrox website at www.wrox.com/go/azureaspmvcmigration

CONVENTIONS

To help you get the most from the text and keep track of what’s happening, a number of conventions are used throughout the book.


WARNING Warnings hold important, not-to-be-forgotten information directly relevant to the surrounding text.


NOTE Notes indicate notes, tips, hints, tricks, or asides to the current discussion.

As for styles in the text:

  • We italicize new terms and important words when we introduce them.
  • We show keyboard strokes like this: Ctrl+A.
  • We show filenames, URLs, and code within the text like so: persistence.properties.
  • We present code in two different ways:
We use a monofont type with no highlighting for most code examples.

We use bold to emphasize code that is particularly important in the present context or to show changes from a previous code snippet.

SOURCE CODE

As you work through the examples in this book, you may choose either to type in all the code manually or to use the source code files that accompany the book. All the source code used in this book is available for download at www.wrox.com. Specifically for this book, the code download is on the Download Code tab at www.wrox.com/go/azureaspmvcmigration.

You can also search for the book at www.wrox.com by ISBN (the ISBN for this book is 978-1-118-67858-9 to find the code. And a complete list of code downloads for all current Wrox books is available at www.wrox.com/dynamic/books/download.aspx.

At the beginning of each chapter, you can find a list of the major code files for the chapter.

Most of the code on www.wrox.com is compressed in a ZIP, RAR archive, or similar archive format appropriate to the platform. After you download the code, just decompress it with an appropriate compression tool.


NOTE Because many books have similar titles, you may find it easiest to search by ISBN; this book’s ISBN is 978-1-118-67858-9.

Alternatively, you can go to the main Wrox code download page at www.wrox.com/dynamic/books/download.aspx. to see the code available for this book and all other Wrox books.

ERRATA

We make every effort to ensure that there are no errors in the text or in the code. However, no one is perfect, and mistakes do occur. If you find an error in one of our books, like a spelling mistake or faulty piece of code, we would be very grateful for your feedback. By sending in errata, you may save another reader hours of frustration, and, at the same time, you can help us provide even higher-quality information.

To find the errata page for this book, go to www.wrox.com/go/azureaspmvcmigration and click the Errata link. On this page you can view all errata that has been submitted for this book and posted by Wrox editors.

If you don’t spot “your” error on the Book Errata page, go to www.wrox.com/contact/techsupport.shtml and complete the form there to send us the error you have found. We’ll check the information and, if appropriate, post a message to the book’s errata page and fix the problem in subsequent editions of the book.

P2P.WROX.COM

For author and peer discussion, join the P2P forums at http://p2p.wrox.com. The forums are a web-based system for you to post messages relating to Wrox books and related technologies and interact with other readers and technology users. The forums offer a subscription feature to e-mail you topics of interest of your choosing when new posts are made to the forums. Wrox authors, editors, other industry experts, and your fellow readers are present on these forums.

At http://p2p.wrox.com, you can find a number of different forums to help you not only as you read this book, but also as you develop your own applications. To join the forums, just follow these steps:

1. Go to http://p2p.wrox.com and click the Register link.
2. Read the terms of use and click Agree.
3. Complete the required information to join, as well as any optional information you want to provide, and click Submit.
4. You will receive an e-mail with information describing how to verify your account and complete the joining process.

NOTE You can read messages in the forums without joining P2P, but to post your own messages, you must join.

After you join, you can post new messages and respond to messages other users post. You can read messages at any time on the web. If you would like to have new messages from a particular forum e-mailed to you, click the Subscribe to This Forum icon by the forum name in the forum listing.

For more information about how to use the Wrox P2P, be sure to read the P2P FAQs for answers to questions about how the forum software works, as well as many common questions specific to P2P and Wrox books. To read the FAQs, click the FAQ link on any P2P page.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset