How to create an installer for ASP.net website with NSIS - asp.net

I want to create an installer for ASP.net website.
Can I use NSIS to create an installer for my web application.
So I wanted to do followings through the installation wizard.
I need to install required databases in client computer.
I need to update the connection string in web.config file based the database.
I need to create ODBC connection and save their names in my project config file.
I need to create an application in application pool of IIS.
I need to host my project in IIS.
Can someone please let me know is it possible to do those things with NSIS?If possible how can I do it?
Thanking you.

There is no exact answer for you.
You need to create a customized installer with custom pages - but it is up to you how the custom pages look like and what they do.
You can achieve this with NSIS (even with Inno Setup which is a little easier to user) but we cannot post tutorial for you.
What you need to do is to start with simple installer (default one) and add custom pages to it. It page represent some functionality:
settings database connection values
writing configuration
creating app pool
setting IIS (there are some NSIS plug-in for working with IIS)
copying files etc.
Start with some NSIS example and add more and more functionality in it until it meets your requirements.

Related

asp.net project installer (Install, creat and fill the database, copy pages and dlls)

I have an asp.net project, and i want to create an installer for the deployment of the project. The installer will check if Sql Server is installed in the server, and if not, it will install it. The installer will also create and fill the database, and finally, it will create an repertory and copy the web pages and the dlls, and create the web site in IIS.
I have no idea how to do all this. So, can you just give the steps to follow.
(the deployment will be on a local server)
Thank you.
You can do this by using installer specialized tools like "InstallShield" or "Advanced Installer". Both tools have dedicated support for this type of setup configuration.

can azure web role instantiate an activeX component?

I have an asp.net website that I'm looking to migrate over to Azure. I have been doing some analysis of the website and code to understand issues with the migration. I am confident that 95% of the code will be fine as most of it is pretty standard web forms and dot net programming.
However, I have just run across an ActiveX component that is installed into the \windows directory on the webserver.
I am wondering if this will be an issue for the migration? There could easily be a number of follow-on questions as well depending on the answer. How do Azure web roles handle instantiation of activeX server components? Can I include the DSINTX.OCX file into the solution or do I wrap it in a dotnet assembly?
private DSINTXLib.Dsintx m_dsintx;
...
m_dsintx = new DSINTXLib.DsintxClass();
Installation of the ActiveX component should not be difficult. You can use a startup task running elevated to install it, assuming that there's an unattended installation mode for it. I blogged about this process for a Windows Service a while back.
http://blogs.msdn.com/b/golive/archive/2011/02/11/installing-a-windows-service-in-a-worker-role.aspx
If you don't have an installation file, then create a script that installs and registers the control and then use RDP to your role instance to debug. The blog post goes over some of these techniques as well. (Use notepad to create the command file, not VS.) You can add the OCX to your project, but be sure to set the Copy Local property to True so it becomes part of the package that is sent to Azure.

Newbie Trying To Deploy Asp.Net Website

I'm basically wondering what the best way to deploy an Asp.Net Web Site is, mostly from the point of view of security. Right now, I'm trying to publish the website using Visual Studio 2010. Could someone direct me to a good tutorial on how to do this securely? For example, can it be done over an encrypted connection via Visual Studio? Is it necessary to install any software on the server to do this? Should I use a different program to open up an SSL (TLS) connection first, and if so, which program (does it come standard with windows)?
The server is running Windows Server 2008. Development is on Vista.
Many thanks in advance for any direction in this matter!
Andrew
I would publish the site to your local machine and file copy the files across to your test/production environment. As a rule we don't publish sites straight from VS to test or production.
For example you don't want to accidentally push things straight from dev into a live environment do you?
As far as the file transfer security goes you could use SFTP.
Note: First thing is to check with the owner of the server, as they often will provide you an FTP connection and will take care of configuring IIS.
If you want to add security, make a keyfile and sign your assemblies and consider running Dotfuscator on your dlls, the community edition is included in Visual Studio. Here is an earlier question where I've put more info on Dotfuscator.
If you have to do the deployment yourself, here's a few things to consider.
XCopy (easy)
MSI (have to create a setup program, you can do this easily in Visual Studio)
There is no security advantage in deploying using Visual Studio, but you can use Visual Studio to create a small setup program. One thing you want to make sure for security is DO NOT deploy any .cs files. Prepare your files, you should compile in Release mode, make sure debug is not enabled in your config file, keep your bin and it's dll, also the aspx, asmx, ascx, svc, css, js, and config files.
XCopy: Install a small FTP server, or use one your company alreayd has, this will allow you to get your files once you are logged into the target machine. You should be able to get an administrator account for the target machine, just ask the sysadmin of the domain, then log on using remote desktop, got to your ftp site, and download your files. Open IIS on the target machine, create a virtual directory and a pool. Copy your files to the location, configure your connection string to your DB if you use one, then test your website.
MSI: same process as above, except the setup will create the virtual directory and pool for you.
Here is extra info on best practices from the official ASP.Net website.
If you have some control on the server (e.g. to configure IIS7), you might want to look into Microsoft Web Deploy (new product just been released):
http://weblogs.asp.net/scottgu/archive/2010/09/13/automating-deployment-with-microsoft-web-deploy.aspx
Haven't tried it myself, but looks quite slick and it apparently encrypts the data being copied up, so might suit you.

ASP.NET project installer registry key?

I have a asp.net project, and wrote a web installer.
The setup exe/msi copies that project in directory chosen by the installing user, and creates an application for it.
How can I get the path my asp.net application got installed to (in the installer)?
I want to write the physical path of my ASP.net application into the registry, because a windows service needs to watch a directory of this web project, and it can't do that, unless it knows where the web project was installed to.
Does the Webinstaller project by any chance write this value into the registry automatically ?
It is possible:
Right-click on the setup project, and choose View->Registry from the context menu.
Right-click on HKEY_Local_Machine, add a new key, call it Software.
Right click on Software, add a new key, call it "MyCompanyName".
Right click on MyCompanyName, from the context-menu, choose new->String
call it installation folder.
Left click on the installationFolder key, and set property value to [TARGETDIR]
Add an additional string key, call it version and give it the value [ProductVersion]
including the []
On x64, you'll find your registry key in regedit under
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\YourCompany]
But programmatically, you can read it normally, from normal projects and web projects, with:
My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Software\YourCompanyName", "Installation Folder", Nothing)
Unfortunately no; IIS uses means other than the registry to store its configuration.
For IIS4, IIS5 and IIS6, you'll need to take a look through the IIS Metabase. This is an XML file in your Windows folder under system32\inetsrv\Metabase.xml; it's XML, so you should be able to read it directly to find the information you need.
IIS7 doesn't use the Metabase any more; instead, see here for details of the managed API to the IIS configuration.
So you may find it best to rework your application to look in either of these places for the directory information that you need.

install ASP.NET + SQL Express in a script

I need a little help on this subject.
I have a Web application written in ASP.NET plus I have the .bak file of the SQL Express database, my question is: How can I install this in a simple click and go way in the client?
how can I write a script that will create a new database, restore the bak file into that database, set up IIS and ... well, that's it :)
I do this all manually, and I do this a lot, so I was just asking if there is a way to prevent do all this steps manually.
Thanks.
You could use WiX to create a .msi that you can use to install your application at your clients. WiX takes a bit to get used to, but once you get the hang of it, you'll meet your needs above, and be able to extend them as your application grows or increases in complexity from the installation point of view.
I read your question to mean you have several clients where you install your application, if that is not the case, and your app exists in one place, there are better solutions, and better people to give them to you!
While WIX is certainly very flexible if you aren't comfortable with the learning curve (and there is a bit of a learning curve IMO) then perhaps you should check out the Web Deployment Projects.
From the blog post:
Web Deployment projects can be used with either the "ASP.NET Web Site" or "ASP.NET Web Application Project" options built-into VS 2008, and provide a few additional build, packaging and deployment options for you to use.
Regarding the database, I'd suggest that you utilise the App_Data directory and just deploy the ".mdf" file. This would be easier than trying to create a new database and restoring a backup.

Resources