Can I deploy package with msdeploy outside of Web Site default physical path? - msdeploy

IIS out of the box got Default Web Site with Physical Path "%SystemDrive%\inetpub\wwwroot"
I am building Web Deploy package with Visual Studio. And I am able to deploy it using .deploy.cmd to whatever application name I specify in .SetParameters.xml file:
<setParameter name="IIS Web Application Name" value="Default Web Site\MyApp" />
But physical path of that application is always inside of Default Web Site physical path. And application folder matches application name - MyApp.
After deployment I can move application into any folder and adjust App's Physical Path.
Is there any way to deploy application into folder other than default in the first place?

You can enable the "Use IIS settings" feature and it will use the path from your local IIS configuration when creating the package locally.
How can I set the deployment path for an iisApp Provider using MsDeploy?

Related

Can an ASP.NET vNext application be hosted in IIS

I'm struggling to workout how to host a local ASP.NET vNext application in IIS. Is this possible currently or is just selfhosting or IISExpress available. Or am I missing the point?
You can use 'kpm pack' to create a package and then drop that in the wwwroot folder. Create an application in the IIS Manager. Refer to the 'using command line' section in the below link to create the packaged web project https://github.com/aspnet/Home/wiki/FTP-deploy-an-AspNet-vNext-application-to-Microsoft-Azure-websites
You can also right click a project in VS14 and click Publish, then choose Filesystem in the dialogue.
Yes, I deployed my app in my local IIS server.
As you can see publish vNext to local system generate two folders approot and wwwroot
You should copy these 2 folders on IIS and specify folder wwwroot as Site Folder

Debug with IIS Express and access files above root

I am developing an ASP.Net project with Visual Studio that is hosted on a local IIS server. The entire site is fairly complicated, and made up of multiple applications, so I am using a Solution/Project that just consists of the current project in its subdirectory.
My application needs to access files that are outside its subdirectory, and I want to use Server.MapPath to access from the root of the actual web site and still be able to debug in IIS Express.
I can't seem to setup or create proper application settings in my subdirectory in IIS Express that allows root access (three folders above the project folder).
Example: I have my app in /Apps/App1 and I have data it accesses in /Data/Data1 but I have the VS Solution setup in /Apps/App1. On the real web server, Server.MapPath("/Data/Data1/file") works fine, but not in IIS Express since / is relative to /Apps/App1.
The account that ASP.NET runs by default will not have rights to access files outside its Virtual Directory. You need to impersnate your part of code with a account which has higher previlage. Or set impersnation in web.config (which is a bit risky)
Here are some articles explaing these
ASP.NET - Reading and writing to the file-system, outside the application
http://www.west-wind.com/weblog/posts/2005/Feb/24/Using-programmatic-Impersonation-from-an-ASPNET-Page

How do I deploy MVC3 Hello World App to localhost and configure IIS

I am having some trouble deploying my MVC3 application to my localhost. I am looking for details to build and deploy a ASP MVC 3 application to my local system. I've tried to deploy this, but have run into problem after problem. Instead of tracking each problem down separately (and I may have to do this anyways) I would like to create a one stop guide for myself and others that see this post.
I'm looking for steps including libraries to install (ASP MVC3, IIS, etc) on a Win7 SP1 machine with VS2010 installed. Also how do I set up IIS, and how do I publish? The goal will be to deploy this web app to another Win7 machine in the house, but localhost will be the first step. In addition, it would be helpful to know whatever steps are necessary to make the website accessible from another machine on the same network.
Here is what I have done so far:
Created an ASP MVC 3 application with VS2010
Built and Run
Installed IIS
In IIS - "Added Application" on "Default Web Site" with the Alias: "Hello"
4a. "Hello" runs on the DefaultAppPool, .Net 4.0; Integrated Pipeline
4b. "Hello" has the physical path C:\inetpub\Hello
In VS2010 - right clicked the project and selected "Publish", using FTP
web browser: navigate to "localhost/Hello"
500.19 - Internal Server error:
Config Error: This configuration section cannot be used at this path. This happens when
the section is locked at a parent level. Locking is either by default
(overrideModeDefault="Deny"), or set explicitly by a location tag with
overrideMode="Deny" or the legacy allowOverride="false"
Config File:
\\?\C:\inetpub\wwwroot\web.config
Requested URL:
http://localhost:80/Hello
Physical Path:
C:\inetpub\Hello
Config Source:
68: <validation validateIntegratedModeConfiguration="false" />
69: <modules runAllManagedModulesForAllRequests="true" />
70: </system.webServer>
Download and install ASP MVC 3
Create an MVC3 Hello World App in Visual Studio
Install IIS from the “Windows Features” / “Turn Windows features on or off” in Windows.
Next, you need to configure a website in IIS. I created one on port 81. Open IIS Manager, and “Add a Website” to the “Sites” node.
For this website, I created this on D:\WebSite, and configured it to run on DefaultAppPool, configured for .NET 4.0, on port 81.
Most of the time, IIS is installed after installing the .NET Framework, so you’ll need to run some commands to register ASP.NET on IIS.
start cmd.exe as an administrator and run aspnet_regiis -i in C:\Windows\Microsoft.NET\Framework64\v4.0.30319
Initially, I had some trouble publishing the project to the destination but for whatever reason, Publish method: “FTP” to Target Location “D:\WebSite” seems to work quite well and publish only the minimum required files.
traditionally you could only deploy to your server using ftp. Though it doesn't make a lot of sense to ftp to a server which runs locally. However Microsoft recently introduce the Web Deployment Tool which works really well. Once you install them then you have the option of creating a deployable package
In Publish dialog, choose option Filesystem instead of FTP, and give it path you have set in IIS

Where is web.config file when running Azure web role in Compute Emulator?

I created an empty Azure Cloud Service project, then added a web role there. The role project has a web.config file.
When I hit F5 the role is deployed in Compute emulator. I went into the folder where role binaries are deployed - there's no web.config file there.
What's happening? Is that because I didn't set "copy always" on web.config file? What web.config does my role use?
If your role is configured for Full IIS mode (for those unaware of the difference between Hosted Web Core and Full IIS, see this blog post), the compute emulator should deploy the web role to IIS where it can be viewed in IIS Manager. On my machine (I'm running Azure SDK 1.5), the deployed web role's physical path is my source code directory.
I think web.config is compiled into your assembly as content in your development environment, and is not directly accessible like in staging/prod. You don't need to use Copy Always, if its marked as Content its all you need. You can use Environment.CurrentDirectory to see your web root path.
Even though the preferred way of storing configuration in Windows Azure applications is in the ServiceConfiguration.cscfg file, there are still many cases when you may want to use a normal .NET config file - especially when configuring .NET system components or reusable frameworks. In particular whenever you use Windows Azure diagnostics you need to configure the DiagnosticMonitorTraceListener in a .NET config file.
When you create your web role project, Visual Studio creates a web.config file for your .NET configuration. While your web application can access this information, your RoleEntryPoint code cannot-because it's not running as a part of your web site. As mentioned earlier, it runs under a process called WaIISHost.exe, so it expects its configuration to be in a file called WaIISHost.exe.config. Therefore, if you create a file with this name in the your web project and set the "Copy to Output Directory" property to "Copy Always" you'll find that the RoleEntryPoint can read this happily. This is one of the only cases I can think of where you'll have two .NET configuration files in the same project!
All info is from Azure Team Blog and I have used this solution successfully- http://blogs.msdn.com/b/windowsazure/

Execute ClickOnce application located on share, through HTTP?

i have a ClickOnce application (online only) which is deployed on a network share. People can run the application by creating a shortcut to i:\ApplicationDirectory\ApplicationName.application
where i is the letter of the drive of the networkshare.
I want to start the application over HTTP. For this, I need the .Application file to be accessible through my webserver. However I am unable to select the ApplicationDirectory as a virtual directory for IIS. I tried copying the .Application file to a virtual IIS path, but this makes the deployment corrupt (i also updated application_files reference in the .Application file). Is there a(nother) way to start a ClickOnce application, deployed on a network share, over HTTP?
First find your ClickonceKey.pfx, in other words the key used to sign assemblies.
Then find mage.exe, the utility for signing manifests that's part of the .NET Framework SDK. For VS2005, it can be found at %ProgramFiles%\Microsoft Visual Studio 8\SDK\v2.0\Bin.
Then create a batch file to execute mage.exe.
Then copy the contents of the network share deployment folder to a new virtual directory on the web server.
Finally, run the batch file.
The batch file should look something like this:
mage.exe
-update >>path to your application manifest in the virtual directory<<
-providerurl >>location of application manifest virtual directory<<
-certfile Clickoncekey.pfx -password >>your password<<

Resources