create a deployment package for Webservice in Visual Studio - c#

I want to deploy my Webservice(*.asmx) on client server.
I need to develop deployment package which will install the virtual folders and deploy the service just like clickonce.
Could someone give me Visual Studio step by step guide to do it.
Thanks,
Kanaya

Most people use Web Setup Projects if the Web Service is simple - any dependencies (e.g. .NET Framework Installation, IIS, SQL Server, a Database, etc) will need to be installed separately by someone in advance of that Setup being run.
For more sophisticated deployments where you want to ensure certain components are on the target machine (e.g. IIS) and if not there get them installed as part of the setup process, then you can use Web Deploy.
Here are some different ways you can do it.
Web Setup Project
Web Deploy
MSDeploy
Here are some guides on the above tools:
http://blog.thinkoriginally.com/2010/02/16/visual-studio-2008-web-setup-project-web-deployment-project-and-msdeploy/
http://www.iis.net/download/WebDeploy
http://cromwellhaus.com/2012/05/build-once-msdeploy-all-over-the-place/
How to use Web Setup Project:
http://www.codeproject.com/Articles/13698/Visual-Studio-Setups-Web-Setup-Part-I

Related

Deploying a web site to azure as a package

I'm starting an ASP.net web project that will be hosted on Azure, but I'm not certain whether to develop the project as a regular ASP.net application and deploy it as a Web Site on Azure, or to develop it as a Cloud Application with a Web Role.
The project's nature is that of a web site (simple database back-end), but the question is one of deployment. We aim to build versions of the application and then deploy to staging and production environments, meaning the output of a build should result in a single package (similar to what's described in msdn).
There's plenty of information on how to create a service package to publish a cloud service, but articles on publishing a web site to azure follow a 'web deployment' scenario, where deployment is done via Visual Studio (subscription file from Azure etc).
Is there a way to deploy a web site to azure as a package? Or are tools like Visual Studio needed for a web deploy? If so, then is composing the project as a Cloud service with only a web role the correct choice?
I posted a comment under the question, regarding differences between Cloud Service & Web Site, but to answer your question about packaging: Cloud Services & Web Sites take two different approaches to deployment, and there's not really "works for both" packaging:
Web Sites are designed to accept your code deployment from either a source code repository. The idea is that you have a labeled version of your code, and push it out from TFS, git, Bitbucket, etc. You can also push your code up with ftp, or drop it into a dropbox folder. Because Web Sites run in IIS, and because you don't have any control over the VM farm running your Web Sites, you cannot push up startup scripts as you can with Cloud Services; you cannot install registry updates, COM objects, msi's...
Cloud Services are designed around a stateless VM model. Every time you scale out (add instances), a baseline Windows Server VM is spun up, and the contents of your deployment package is copied to the new VM instance and executed. This includes startup scripts, installers, etc. Since you have admin-level access to each VM, you can configure it as you need to, from your startup scripts / OnStart(). Definitions for each role are combined into a single deployment package. To update one or more roles, you need to redeploy the package.
Web Sites have no tooling pre-requisites, while Cloud Services require Visual Studio or Eclipse to help you manage the deployment package. You can also use PowerShell and Visual Studio command line tools to build the package, as #Ben Robinson mentioned in the comments above. You can also use PowerShell to create and administer Web Sites. Both Cloud Services and Web Sites provide Staging and Production slots.
You can't push a deployment package to Web Sites.
David's answer does a great job covering the Cloud Services option. However, I believe the Azure Website option is well-suited to your needs. You don't have to deploy using Visual Studio. Instead, you can create a publish profile in Visual Studio that creates a Web Deploy Package which is simply a ZIP file that can be published at a later time using command-line tools, no Visual Studio required. It also generates a .deploy.cmd file that you can run to deploy to a remote server, and a SetParameters.xml file with parameters such as connection string that you can modify for your target deployment environment. The .deploy.cmd file calls msdeploy.exe which does the actual deployment.
See this for more details on Web Deploy command-line deployment. There's also a ton of information on MSDeploy and its package system on Sayed Ibrahim Hashimi's blog.
If you want to be able to change files directly in the web application then it is best to use an Azure Web App, because you can access those through FTP.
However an Azure Cloud Service does not provide FTP Access, at least not a useful one that would allow you to use an FTP Client to upload files. A Cloud Service is where you do not want to be bothered too much with much of the details of hosting a web application. While an Azure Web App does much of the same thing, it also allows you to have FTP access and direct access to the files post-deployment.

How to deploy web service along with a windows application installation?

I have a multi tier windows application. one of the layers is implemented using web services and the UI layer communicate with this layer. I want to make an installation package for the application and i need the installation package to deploy the web services to the local machine's IIS during the installation, so the user doesn't need to go to IIS and configure it manually.
You can package your Web Service (or any web application) as a Web Deploy Package.
See this link on how to do this from Visual Studio: https://www.tutlane.com/tutorial/aspnet-mvc/asp-net-mvc-publish-with-web-deploy-package
Such a package also comes with a .cmd file that could be run by your setup. Read the deploy-readme.txt alongside it to learn more.

Installing patch for Asp.net web application setup

I am using visual studio web project to install my web application and do some customization like modifying connection string in web.config file during install time.
Now, My requirement is to create a patch for the web application so that next time the web installer only the changed files.
Is there is any one to do it using visualk studio 2010 ide or any other way.We can't use third party products like Installshield,wix,innosetup etc.
Please suggest.
Visual Studio doesn't support patches for setup projects. It supports only major upgrades.
If you really don't want to use other setup authoring tools, you can try creating the patch manually. You can read more about this here:
http://msdn.microsoft.com/en-us/library/aa370578(VS.85).aspx
But it won't be easy.
If it is just Web project, I would recommend re-deploy instead of patching. Meaning you just deploy new version of site, above the previous one.
Except some really comprehensive case that strategy works all the time. I use simple xcopy deploy for all my projects.
You can write a mini C# app to do it. You can have the list of assembly files in a configuration. On loading of the app, it checks the timestamp difference between server and client files. On finding the change, the mini app pushes the changes file.
Hope, it will resolve your issue
There may be better suited solutins to deply websites than using an installer. For one, there's Web Deploy.
It's main purpose is deploying web applications to IIS and it allows you to modify key configuration values through a simple UI.
Web Deploy works with deployment packages; a big zip containing your application and some meta data to help install it. On deployment it will diff the deployed site with the data in the deployment package to update existing files, add new ones and remove obsolete files.
You can build deployment packages directly from Visual Studio and/or from MSBuild, using your favorite build server.
Web Deploy works really well when you need to deploy often or when you have to delegate deployment to IT staff.
Customizing Web Deployment package is a bit tedious though, you may find a blog post I wrote about this useful.
For simpler situations, I recommend good version control practices and xcopy deployment.
If you tag what you deploy to your server, you can zip up the changed files since last deployment and copy those to your server.

.NET build & deploy

To deploy my app on a clean server takes several steps: Start MSSQL service, install .NET4, deploy code, install DB schema, add SSL certificate to IIS7...
Thereafter I follow a more boring task of: Zip up my app files, transfer them to the server, load them into the web app folder etc.
The deployment is done on a semi-frequent basis as my product sells to enterprise customers. Thereafter it's the boring build and deploy task.
Is there a recommended .NET tool that can help automate the above tasks? BTW, I use VS2010 with IIS7 and .NET4.
Web Deploy
Web Deploy (Web Deployment Tool)
simplifies the migration, management
and deployment of IIS Web servers, Web
applications and Web sites.
Administrators can use command-line
scripting with Web Deploy to
synchronize IIS 6.0 and IIS 7.0
servers or to migrate an IIS 6.0
server to IIS 7.0. Web Deploy Tool
also enables administrators and
delegated users to use IIS Manager to
deploy ASP.NET and PHP applications to
an IIS 7.0 server.
Web Deploy enables you to package
configuration and content of your
installed Web applications, including
databases, and use the packages for
storage or redeployment. These
packages can be deployed using IIS
Manager without requiring
administrative privileges. The tool
integrates with Visual Studio 2010 to
help developers streamline the
deployment of Web applications to the
Web server. The tool also integrates
with the Web Platform Installer to
allow you to simply and easily install
community web applications. You can
submit your own application to the Web
Application Gallery
Features
Seamless integration with IIS 7.0
Manager and Visual Studio 2010
interface for creating packages and
deploying them onto a machine, both
locally and remotely. Seamless
integration with the Web Platform
Installer to install community web
applications simply and easily. Web
application packaging: Ability to
package a Web application or an entire
site, including the associated
databases. Ability to package ACLs,
COM, GAC and registry settings.
Supports both live servers and zipped
packages as a source or destination.
Web application deployment:
Administrative privileges are not
required in order to deploy Web
applications. Ability to add powerful
parameters to change text in files
when they are deployed (such as
prompting to replace a connection
string when deploying from QA to
staging environments). Integration
with the IIS 7.0 Web Management
Service (WMSVC) for remote deployment
by non-administrators. Server
administrators have granular control
over the operations that can be
performed and can delegate tasks to
non-administrators. Web server
migration and synchronization: Ability
to synchronize or migrate the entire
Web server, a Web site or application.
Synchronizes only the data that has
changed. Ability to detect missing
dependencies during synchronization.
Automatically gathers content, IIS
configuration, SSL certificates and
ASP.NET configuration when you sync a
Web site. In addition to the IIS
Manager and Visual Studio 10, tasks
can be performed using the
command-line or public APIs.
Yes, Powershell can do all this for you. Pretty much anything a .NET program can do, Powershell can do it since you can import .NET assemblies and use it in powershell.
I use powershell in my project to:
1) Setup the registry
2) Unzip the dropped code
3) Build the web folders and move files
4) Deploy SQL stored procedures
5) Restart IIS
For an in-depth review of using Powershell for deploying see this
article
Have you considered creating an MSI to install using Windows Installer?
You can do this using InstallShield or Wix and can get much of the functionality you describe for "free" (e.g. installing .net, starting/stopping services, deploying code, etc.).

Web setup problem

I need to package my ASP.NET Silverlight web site to a single MSI file.
But when creating web setup project, it can't install on iis version greater than 6. On greater versions it only installs when 'IIS 6 compatibility mode' is enabled on server. How can i make my setup project, so it installs correctly?
PS I don't have admin rights on server.
If you are installing to IIS7+, I'd suggestion using Web Deploy. It simplifies IIS deployment and is now the recommended way to deploy to IIS7 or above. Also, there is good integration with Visual Studio 2010 as well as both MMC and PowerShell integration with IIS.

Categories