الجمعة، 29 أبريل 2011

Hosting Your Silverlight Application: Web Site or Web Application?


Hosting Your Silverlight Application: Web Site or Web Application?


In Visual Studio 2010, should you use a web site project or a web application project to host your Silverlight application? The main difference between a web site project and a Web Application project is how the files are compiled and deployed. Each has its advantages and disadvantages. In the end, the choice pretty much comes down to user preference. Let’s take a quick look at each approach.


Using a Visual Studio Web Site
A Visual Studio web site is nothing more than a group of files and folders in a folder. There is no project file. Instead, the site simply contains all the files under the specific folder, including all text files, images, and other file types.
A Visual Studio web site is compiled dynamically at runtime. An assembly will not be created, and you won’t have a bin directory.

The following are some advantages of using a Visual Studio web sit

• You don’t need a project file or virtual directory for the site.
• The site can easily be deployed or shared by simply copying the folder containing the site.


The following are some disadvantages of this approach

• There is no project file that you can double-click to open the site in Visual Studio.Rather, you must browse to the folder after opening Visual Studio.
• By default, all files within the site’s directory are included in the Web Site project.
If there are files within the site’s directory that you do not wish to be a part of the web site, you must rename the file, adding the extension .exclude.
Using a Visual Studio Web Application Project
A Visual Studio web application project is the more traditional type of web project used prior to Visual Studio 2005. When Microsoft developers introduced the “web site” concept, they did not take into account the many developers who were comfortable with the project-based solution approach. To accommodate those developers, Microsoft announced the Visual Studio 2005 Web Application project as an add-on to Visual Studio 2005. In Visual Studio 2008 and 2010, this project type is once again a part of Visual Studio.
The following are some of the advantages of using a Web Application project:
• All of the code files are compiled into a single assembly, placed in the bin directory.
• You can easily exclude files from a project, since all files within the project are defined within the project file.
• It’s easier to migrate from older versions of Visual Studio.
A disadvantage is that it can be more difficult to share your solution with others, if that is yourintent.
In the end, both approaches have their pros and cons. You need to determine which one is more suitable for your application, depending on your specific purpose and goals. For more information about these project types, refer to the MSDN documentation.

0 التعليقات: