Working with an mvc4 application that runs in IIS 7.5, the site though exist once on disk, has over a 100 url's pointing to it. This is because the site displays content based on the country that needs to access it.
Due to this, the site can have over a 100 bindings, which is very hard to manage.
I am looking to automate the creating of the site in IIS using powershell. I would run this during each deployment to ensure each of my environments are identical (dev, qa, production).
The powershell script would delete the site and recreate it, applying bindings, configuring it etc. I am a newbie to powershell so I would appreciate any help with this.
You should be able to use the PowerShell IIS Administrative Cmdlets. I show how to automate creating and deleting web applications using them on my blog that should get you started.
I have a script I use when creating a website and AppPool in IIS 7+ (under .net4, Integrated pipeline, etc) and thought you might find it useful as its a bit simpler than some of the other answers. It will delete the site and replace it if it already exists making it good in continuous integration scenarios.
Use it as so:
CreateSite.ps1 [WebsiteName] [AppPoolName] [Port] [Path]
If you are reinstalling the site, you will need to stop it first. That is done as so:
StopSite.ps1 [WebsiteName] [AppPoolName]
you gan grab the scripts from my gist
There is an IIS provider for PowerShell which you can use to manage IIS from PowerShell.
Take a look at the available cmdlets.
Related
I have a Classic ASP website hosted on Azure (migrated now, rewrite later) and found there is a dependency on AspEmail.
To register on a normal IIS box the command is:
regsvr32 c:\AspEmailDir\AspEmail.dll
The SO answer here shows how to do this with a webrole but I have a website.
I was thinking a WebJob might work, or is there some other way?
I don't think you will be able to do this on Azure website. I see two solutions here:
Move to web role. Then you can execute this via startup task.
Get rid of AspEmail or move it to a separate worker role.
We currently host our site on IIS on our own virtual machine. Works great.
Our main website has around 30 or so bindings, which we use to customize the html output. Each binding is a theme, to us. So red.mywebsite.com will have a red background, for example.
If we move over to azure web site, does azure allow us to do this also?
If yes, can we do this programatically?
Yes, Azure Web Sites does support multiple bindings per single web site.
This feature is, however, only available for Shared and Reserved instances scale mode.
Configuring the the bindings is done via Custom Domain Management for the targeted Web Site. You can add multiple custom domains, which effectively will edit the bindings in IIS. However you must be aware that SSL is not yet available for Azure Web Sites.
There is also programmatic way of managing the bindings, but is not documented yet, as this feature is preview. You can manage Azure Web Sites via the Windows Azure PowerShell Management cmdlets. But this is not yet documented. If you get the latest Windows Azure PowerShell from here you will have these commands:
New-AzureWebSite
Get-AzureWebsite
Remove-AzureWebsite
Set-AzureWebsite
Show-AzureWebSite
Start-AzureWebSite
Stop-AzureWebSite
There is also REST Management API (which is used by the PowerShell cmdlets), and it also is not documented :(
Simple reverse engineering (using fiddler) shows that the *AzureWebsite commands connect to the following address:
https://management.core.windows.net/[subscription-id]/services/webspaces/
Just a quick note, help for the command Set-AzureWebsite shows there is a switch -HostNames, which is documented as follows:
-HostNames <String[]>
The fully qualified hostnames that can be used to access the website
I believe this is what you will need.
You could try digging in deeper.
I am looking at migrating a dotnetnuke website to Azure. I need both staging and production versions of the site to be running.
I have looked at using Azure Websites, but at the moment there is no support for SSL on custom domains so this can't be used for the production website. I have migrated the staging site to an Azure Website and now have numerous options for publishing updates (ftp, git, using web matrix).
Due to the constraints of Azure Websites, I used the DNN Accelerator to create a cloud service for the production environment. This set up will allow me to have control over IIS and therefore manage SSL certificates (I think).
The problem I have with this is there does not seem to be any publishing options. The only way I can publish is by connecting to the Azure instance via RDP and then copying the website files onto the files system.
Are there any other ways of publishing? I have looked at converting the website to a WAP, but I believe this has implications when it comes to updating to new DNN versions.
You should never publish your application through RDP since these changes are non-persistent (meaning what you published might disappear after a hardware failure / ...). Adding new instances would also mean that these instances don't have the files you published before.
I suggest you start by looking at the DotNetNuke Azure Accelerator first. If this doesn't fit your needs you might always try to build something yourself, but if you want to say with a regular website and not a web application I wouldn't count on Visual Studio support. In that case you might want to look at creating a package from the command line and using startup scripts to add your website in IIS.
Sounds like you need to use a Start-up task to install the files in the correct place for a Web Role (Cloud Service) Smarx has a nice overview here, MSDN has a wealth of info too http://blog.smarx.com/posts/introduction-to-windows-azure-startup-tasks
Another option is IAAS for Azure with a persisted VM, more work mind you, Cloud Service would be the most efficient and correct solution...
How do I configure Azure Web Role to have United Kingdom (as opposed to US) as it's language/regional settings etc for all accounts? I believe I can RDP in and change it. However I want to set it to default on creation of the web role. It is making a difference to some classic ASP pages we have in a legacy app.
Interesting problem. Can't say I've attempted this before. What you want is to set a different locale at startup so that it is always enforced as VMs making up your Web Role may be rebooted from time to time.
Unless someone comes up with a better idea you could try to modify the registry from a Windows Azure Startup Task. You would need to know which user locale to modify and you would need a registry changing CmdLet like this one (though I haven't tried it): Set-RegistryKey.
Given you can figure out what registry value to modify and what user is running your IIS this could be done.
Use a Startup Task. Call a Cmd script and envoke a PowerShell script. Call the CmdLet and set the locale you want.
I realize this is not a complete solution, just a suggestion. Hopefully it is worth while.
Following the release of SharePoint 2010, there has been renewed interest in using PowerShell to manage SharePoint solutions. I'm interested in finding out how my peers are currently using PowerShell with SharePoint, either 2007 or 2010.
For example, I use a PowerShell script to determine the number of sites, sub-sites and pages that have been created in specific web applications. Can you provide details of how you make use of PowerShell?
We're developing some custom SP2010 software. We're using Powershell cmdlets to install and upgrade builds on our test machines, as well as do some initial configuration tasks such as deploying features to certain webs, and creating service apps & service app proxies.
Unfortunately the cmdlets don't seem to play well with PSRemoting, which makes automated build & deploy trickier.
I use PowerShell for installation and debugging purposes. I'm surprised that you haven't used Powershell with SharePoint 2010.
I write quite a few scripts for deploying and managing many solutions. For Example, Every time we deploy our PerformancePoint dashboards, it removes the top the global navigation. I use a Powershell script to re-insert the global navigation based on a XML File that I have created.