MSDeploy migrate only configuration from IIS 6 to 7 - iis-7

We have 19 websites, many of which have many "virtual" directories, on a IIS 6 server. I am trying to migrate the whole thing over to IIS 7 on a different server.
Following the instructions on http://learn.iis.net/page.aspx/427/migrate-a-web-site-from-iis-60-to-iis-70/ I attempted the following command line execution:
msdeploy -verb:sync -source:metakey=lm/w3svc -dest:package=D:\Temp\Sites.zip > D:\temp\WebDeployPackage.log
It appeared to be working until I got a "There is not enough space on the disk" error. The D drive, which you'll notice is the target location for the package and the log has plenty of space (all the resources for the websites are about 5gb, the drive has 200+). Though the C drive is of limited size (6Gb), so that might be the problem.
Anyway, I figure the best bet was to try and do a migration of settings/configurations only, not the actual resources. We can easily deploy the resources to the new server with our NAnt build scripts, so that's not an issue. Getting all the correct configurations moved over, however, would be challenging to do manually.
So, is there a way to export/package only the configuration/options of the IIS 6 server using msdeploy (or any other tool?)

Think I might have found it: as described here: http://forums.iis.net/t/1159017.aspx
Note the addition of -disabledLink option:
msdeploy -verb:sync -source:metakey=lm/w3svc -disableLink:contentExtension -dest:package=D:\Temp\Sites.zip > D:\temp\WebDeployPackage.log

Related

Create IIS Website with Rake

I am using rake and albacore to build my .net ASP MVC project, however one part I have not been able to automate so far is deploying the built project to IIS. Currently on developer machines I get the developers to manually create the websites and link them to a released output folder generated by the build.
However now that we have our CI box setup (Teamcity) I am needing to automate the setup of the website to IIS, so are there any rake tasks which can create a website on IIS? I remember seeing one a while back but cannot find it.
I can install the IIS 6 meta scripting stuff (cant remember its exact name) and any other iis plugins, the box currently runs IIS 7.5.
== Edit ==
The one I remember seeing a while back was InetMgr (https://github.com/typesafe/inetmgr), which seems a little unstable and doesn't work for me but doesn't seem to be supported any further.
Not the best of answers, but as I couldn't find anything simpler than the proposed method below I just wrote something myself using appcmd:
def create_web_site(site_name, site_location, site_port)
delete_command = "#{$file["appcmd"]} delete site #{site_name}"
result = system delete_command
puts "Failed to delete site on IIS: #{$?}" unless result
add_command = "#{$file["appcmd"]} add site /name:#{site_name} /bindings:http/*:#{site_port}: /physicalPath:#{site_location}"
result = system add_command
raise "Failed to add site on IIS: #{$?}" unless result
set_app_pool_command = "#{$file["appcmd"]} set app #{site_name}/ /applicationPool:\"ASP.NET v4.0\""
result = system set_app_pool_command
raise "Failed to bind site to .net 4 app pool on IIS: #{$?}" unless result
start_site_command = "#{$file["appcmd"]} start site #{site_name}"
result = system start_site_command
raise "Failed to start site on IIS: #{$?}" unless result
end
$file["appcmd"] in the above is a global file lookup for my build scripts, this is c:/windows/system32/inetsrv.
I would love to find a nicer solution so if anyone comes across a nicer way of doing this add the answer and I will change the correct answer if it is any better. The only 2 libraries for doing this I found were dolphin deploy and 7 digital's iis rake script, neither of which seemed well documented on how to use unfortunately.
I suggest you check out Capistrano. Capistrano is deployment "framework" for ruby/rails/... applications. Check out getting started part of documentation and then look at this "tutorial" on how to deploy to Windows Server with Capistrano.

ASP.NET 3.5 and KB2533623, KB2507938

If I install either KB2533623 or KB2507938 on a Win 7 or a Win 2008, it kills my ASP.NET 3.5 application. The actual error I receive when loading the project is :
Invalid access to memory location. (Exception from HRESULT: 0x800703E6).
I don't have the full stack trace, but the error is coming from the LoadAllAssembliesFromAppDomainBinDirectory() call. Now the MS updates have made modifications to the way "insecure libraries" are loaded. My guess is that is causing me the problem. Removing these 2 updates will resolve the problem. It's not a machine specific problem, because this has happened on a total of 6 machines across 2 operating systems and managed by 3 different groups (so not just a bad image or something).
Assuming I need to secure my libraries, are we talking about just signing them? And if a 3rd party library is not signed, what then? Is there a way to tell ASP.NET to accept the libraries?
MSDN article http://msdn.microsoft.com/en-us/library/ff919712(VS.85).aspx talks about setting directories to load from. If this will resolve the issue, can I implement this before ASP.NET attempts to load all of the libraries from the bin folder?
Tony, I am not sure if following is the solution for you, but I don't have enough reps to put in a comment.
So some questions and suggestions:
1. On the front end do you get a HTTP 500 error?
2. Are these dlls in the bin folder of the web app?
If answer to any of above is yes, try this 'hack' -> Right click on the bin folder in Explorer and give [System]\Users access to the folder (where system is the name of the machine). First try with readonly, then try read write.
Normally your admin will baulk at doing this on production site. So someone will have to tell us how to 'actually' fix the issue.
You could also try the solution for the user running the AppPool.
I have had 500 errors with Ajaxcontroltoolkit.dll in bin folder and this is how I have resolved it.
Hope this helps.

How do I find out whether enabling gcServer config is taking effect?

I'm supporting a ASP.NET v2.0 app installed on a Windows 2003 SP3 Enterprise on a quad core 8G machine running on .NET 2.0 SP1.
before enabling the config, ran "tasklist /m mscorwks.dll"
Image Name PID Modules
w3wp.exe 7888 mscorwks.dll
add under section in web.config
ran IISRESET, rebooted server too
ran "tasklist /m mscorsvr.dll"
INFO: No tasks are running which match the specified criteria.
ran "tasklist /m mscorwks.dll"
Image Name PID Modules
w3wp.exe 6251 mscorwks.dll
It seems like gcServer is not taking effect. Are there any additional settings/ configurations necessary to get it working?
Update: Sorry, just saw that the link below, and thus maybe the whole information, applies to IIS 6.0. I don't know whether that is applicable to your environment.
I don't believe you can configure any GC setting on a per AppDomain basis, which is essentially what would happen when you only set it in a web.config file, thus on a per application basis.
You need to set this in the aspnet.config file. The Aspnet.config file is in the same directory as the Aspnet_isapi.dll file (check this for more information).
Edit: To figure out the GC in use, you can use WinDBG/SOS and the eeversion command:
0:010> !eeversion
2.0.50727.3082 retail
Workstation mode
SOS Version: 2.0.50727.3053 retail build
See this MSDN link, where Chapter 5 had the answer. Quote from Chapter 5:
Note: At the time of this writing, the .NET Framework 2.0 (code-named "Whidbey") includes both GCs inside Mscorwks.dll, and Mscorsvr.dll no longer exists.
I guess there is no way to check whether the server GC is working. EDIT: but see Christian's answer.
From code you can use GCSettings.IsServerGC.

Rails Warbler Deployment

I am doing some testing to determine resource usage of a rails war. I have used Warbler to package the "15-minute Blog" application using Rails 2.3.5 and JRuby 1.4.0. I am deploying into Tomcat 6.0.24 and create multiple deployments by copying the blog.war file as blogN.war.
This worked great for the first 4 deployments but I can't seem to deploy any more than 4 instances of the war; in other words, the catalina.out log hangs with "Deploying web application archive blog5.war".
Any ideas on what the problem might be or how I might better trouble-shoot this?
Increasing PermGenSpace memory to "-XX:PermSize=64m -XX:MaxPermSize=128m" corrected this problem.
Check your log files, may be the case that your java process, in which tomcat executes, runs out of memory, see java parameters ( -Xmx -Xms ) and http://wiki.apache.org/tomcat/FAQ/Memory . Increasing the available memory may allow you to run more instances of the application.

Replicate IIS setup from one machine to another

Looked for an answer to this and didn't see it.
This is for IIS 6.0 / Windows Server 2003.
I'm working with an extremely large ASP/ASP.NET application and I'm trying to get my development environment to match my team members environment. This process is basically trial and error: get an error, go into IIS, make a change, hope the error is fixed. Ugh. I'm hoping to find a way to replicate a set of IIS directories and their configurations on one machine onto my machine.
I did find a script that will iterate through and give me a list of all virtual directories on a machine. It helped, but not a lot since I still have to go in and set up all those virtual directories (I think there are like 20 of them ballpark). The whole process is complicated by the fact that we're mixing ASP and ASP.NET applications in the same application which spans many solutions and projects. Getting the whole thing up and going seems like way too much work but I've never heard of a real solution to this.
Would Powershell be helpful here?
You should export and import IIS metabase.
These might help:
IIS Settings Replication
IIS Metabase Backup and Restore
Fortunately, in IIS7, ASP.NET config is integrated with IIS config so the job is done by copying Web.config.
Here's Microsofts' documentation for iiscnfg. iiscnfg documentation
When I ran it the first time, I got an error that said "This script does not work with WScript." If that happens to you:
1. Click OK.
2. At the "Would you like to register Cscript as your default host for VBscript?" click Yes.
3. At "Successfully registered Cscript" click OK.
4. Run the command again

Resources