Multiple applications in one IIS website with MS Release Management - devops

I am using the IIS Web App Deployment Using WinRM extension for MS Release Management vNext template (TFS 2015 Update 2). I can deploy a simple website so I think that my permissions and everything must be set-up properly.
My issue is that I would like to have multiple web applications hosted in a single website and deploy it automatically.
The WinRM - IIS Web App Management task does not seem to have an option for doing this. How can I do it?
I have tried adding a / to the Website name however this gives me an exception:
Exception calling "SetRight" with "2" argument(s): "Could not obtain the user information.".

I found an issue on github.com/Microsoft/vsts-rm-extensions which says that you should do the following:
Add a Manage IIS task which creates the website
Add a Deploy IIS task which deploys to website\app and set the Override Parameters to name="IIS Web Application Name", value="$(WebAppName)" where WebAppName=website\app.
It would be a lot better if the deploy task had an option to add the website application or something.

Related

MSBuild WebDeploy error when deploying to a virtual directory

I'm a newbie to TFS Deployment, I'm facing a strange issue when I try to deploy to a website in the form ABC\SomeVirtual
The error code is
Deployment on one or more machines failed. System.Exception: ERROR ( message:Can not set attribute "name" to value "ABC\SomeVirtual".. Reason: Invalid site name . )
If I put a site name without '\' it works...
I've tried either to put in the form ABC/SomeVirtual but nothing works... any suggestion?
Seems you are using TFS 2015, in TFS 2015 IIS Web App Management task can only create website name, it cannot create the virtual application name. So you cannot use '\' or '/' to create the virtual application name using this task.
Generally, if the website is not exist, then you can use IIS Web App Management task to create the website first, then use IIS Web App Deployment task to deploy to the website or virtual Application like Site/Application...
If the parent website already exist, then you can directly use IIS Web App Deployment task to deploy the virtual application, IIS Web App Management task is not necessary.
For example:
To create an application named Site/Application (Test0906/0928 in below sample), you need to make sure the Site (Test0926 in below sample) already exist there... Reference below screenshot:

404 error on azure for Asp.Net Web Api Project

I have deployed exact same solution on two servers, one is my own server in my basement and the other one is Microsoft Azure. The project is developed using Asp.Net Web Api 2.
On my own windows server running IIS 8.5 it totally works. For test, you can simply browse this link in your browser and see the error message {"Message":"The requested resource does not support http method 'GET'."} which shows the API has been hit.1
But exact same project on my Azure domain here, you just get a message saying
The resource you are looking for has been removed, had its name
changed, or is temporarily unavailable.
Everything about these two deployments is the same (to the best of my knowledge) and I was wondering if there is any further steps necessary on Web Api app deployment in MS Azure which I am missing.
I finally found the answer to this issue. If there are multiple apps deployed as one single website so each app is located in its own subfolder, you have to go to the configuration section of your web app on Azure and create virtual directories for each of those sub folders.
Ah, my problem was probably a common one. I was using
rootconfig = System.Web.Configuration.WebconfigurationManager.OpenWebConfiguration(null);
and that was returning the root web because the parameter was null.
When I ran it local that worked fine, but after I deployed the root Config was NOT what I wanted and my code was failing.
Switched to direct access via
stringVal = WebconfigurationManager.AppSettings["Foobar"].ToString();
Nice. Plus less overhead.

Umbraco 7 in Azure cloud as web roles

I have been trying to get Umbraco working in a web role environment (web services) in Azure, but the site errors when you try and access it, saying that config/trees.config is not accessible.
These are the steps i carried out:
Create a new empty MVC4 project in Visual Studio 2013
Install Umbraco v7.1.8 from nuget
Run up and configure using a new azure SQL database.
Added in the umbraco folders to the solution.
Added an azure web services project to the solution.
Added the existing MVC umbraco project to the azure role profiles.
Published to Azure staging area.
The site starts up with the usual 'Looks like there is still work to do' screen in the full Azure emulator in visual studio with multiple role instances. However fails to run up when hosted in Azure.
I am currently assuming that the issue is that the site root does not have write access when hosted in Azure, so the IIS worker process cannot write to the trees.config file.
I found an article where you can add a 'startup.bat' file, with the following:
echo "starting startup task" >> log.txt
%windir%\system32\Icacls.exe .. \* /T /grant "Network Service":(F) > log.txt
But this stops the role instances for starting up at all in both the emulator and when hosting in azure.
Any suggestions would be gratefully appreciated
I would suggest using a VM instead of a web role for hosting Umbraco in Azure, particularly since Umbraco is needing local write access to persist.
Web roles expect your application to be stateless, meaning no writing or persisting anything to the actual file system. This guarantee allows Azure to make certain assumptions so that it can load balance and scale the application correctly (it basically saves a master copy and then re-deploys it fresh as it scales up or makes updates, etc. This works great for web apps that were created with this in mind, but if not, then a VMs allows you to scale UP without worrying about your app needing to work a certain way to properly scale OUT under a load balancer (which is what web roles are made to help you do).
So, basically I would suggest installing to a Virtual Machine. It's still in the cloud, and you get all the cloud benefits of on-demand scaling of the infrastructure. In addition, I would expect Virtual Machines to be a supported install of Umbraco, where a web role install would not. Hope that helps!

Deploying a MVC4 website to Azure storage

I am developing a website in Mvc4 using visual studio 2012 and now I am facing a problem regarding web deployment or I can say that I'm not getting solution for this problem.
My problem is that I want to publish my website from my website view I want to give a button in home page of my website as I click on that button my database updates in IIS or azure server. How can I do this any idea about it ??
I am Currently Using Azure Storage and IIS server for local testing.
if you want to do deploy for "Azure WebSite" and not "Azure WebRole" you may use FTP transfer.
if you want to do deploy for WebRole, the first thing you have to open Remote Desktop on it and probably PowerShell will help you to deploy. You may find more details on that subject in Azure Enable Web Deploy via automated deployment and Powershell - Create Azure Deployment Package
Also please keep in mind that your infrastructure must be in separate environment. If you try to control publish/deploy from a same site (say you are on Site X and you are deploying for Site X) if anything goes wrong, you will lose all the control.

Best way to deploy an ASP.NET MVC app on IIS 7 / Server 2008?

So far, the only successful strategy I've been able to get by with is the following:
Configure YOURAPP.Web to "Use Local IIS Web Server" and set "Project Url" = http://localhost/yourapp.web
Click "Create Virtual Directory"
In IIS Manager ensure that "Classic .NET App Pool" is selected
Add wildcard mapping * named "ASP.NET-MVC" that points to IsapiModule
BUT I don't really like the idea of having the full ASP.NET pipeline invoked when requesting any resource (javascript file, stylesheet, image, etc...) which is exactly what happens with the wildcard mapping.
So is there a way around this?
Is there a better method to running mvc apps on IIS 7?
I'm definitely open to suggestions as I'm not all that satisfied with what I got so far.
Thanks - wg
Make sure IIS7's "Managed pipeline mode" is set to "Integrated". That has been the single most important thing to do (for me) to get my MVC app running smoothly on IIS7.
Here's a good blog post too.
When developing the app, I have had no issues using the "Visual Studio Development Server" for running the app.
Assuming that all of your CSS/JS/image files reside in the Content directory, you could add an ignore route.
routes.IgnoreRoute("Content/{*wildcard}");
This will prevent any requests to the content directory being handled by MVC.
IIS7 is designed to take all requests and push off the static file stuff efficently. I wouldn't worry about it in the same way one worries about wildcard mappings on IIS6. There is no "load ASP.NET pipeline" penalty because IIS7 is a mean honking ASP.NET pipeline all the time.

Resources