I am trying to use aspnet_compiler via the command line to build and publish a web application that is running on the IIS7 Default Web Site. I am struggling with finding the correct syntax of the -m argument for specifying the IIS metabase path.
All the documentation refers to IIS6 metabase paths, which are of the format "LM/W3SVC/1/Root". I came across this information, which indicates the IIS7 metabase path should look like "MACHINE/WEBROOT/APPHOST/Default Web Site."
The actual command then looks like this:
aspnet_compiler -nologo -m "MACHINE/WEBROOT/APPHOST/Default Web Site/" \\productionwebserver\inetpub\websitefolder\
This, however, results in the following error: error 1002: 'MACHINE/WEBROOT/APPHOST/Default Web Site/' is not a well formed IIS metabase path.
My default website is called "Default Web Site". I have also explored using the syntax of specifying the virtual path and physical path instead of the metabase path, for example:
aspnet_compiler -nologo -v / -p ".."
(this command file exists in a sub-folder of the website project folder)
This results in the following error: error ASPCONFIG: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
The website builds fine from within VS2010.
Use the same path, but make sure that you have IIS 6 Metabase Compatibility component installed for IIS 7,
http://learn.iis.net/page.aspx/125/metabase-compatibility-with-iis-7/
Did you try to use the same path as for 6.0 - like LM/W3SVC/1/ROOT?
Related
Requirement:
I have zip package which i need to deploy into specific site (say dev.sitename.org) under IIS.
Earlier , we had site under Default Web Site (under IIS) and we used below command to deploy it.
>>msdeploy -verb:sync -source:package="D:\package.zip" -dest:auto
I have tried different provider for -dest , but nothing worked.
Does anyone has idea on this. Please share if any.
Try setting a ProviderPath parameter:
msdeploy -verb:sync -source:package="d:\package.zip" ^
-dest:auto -setParam:kind=ProviderPath,scope=iisApp,value=dev.sitename.org
Your provider might be a contentPath, rather than an iisApp, depending on how you created it. Open the manifest file in the root of the zip to double check.
I have a web application and I am trying to deploy it on a webserver using MSDeploy.exe (Web Deploy 2)
I have tried 4 scenarios:
Through VS2010 Publish method with following settings:
Publish Method: Web Deploy
Service Url: https://MyServerName:8172/MsDeploy.axd
Site/application: MyWebSiteName
Allow untrusted: checked
Username: MyUsername
Password: MyPassword
This method works just fine.
On MyServerName machine I have Web Management Service running; I have a website MyWebSiteName, an application MyWebAppName and MyUserName is an IIS Manager for it.
Through VS2010 Publish method with following settings:
Publish Method: Web Deploy
Service Url: https://MyServerName:8172/MsDeploy.axd
Site/application: MyWebSiteName/MyWebAppName
Allow untrusted: checked
Username: MyUsername
Password: MyPassword
This method works just fine.
Through MSDeploy.exe command line (within a Powershell script)
$Source = "contentPath='...._PublishedWebsites\MyWebApp'"
$Destination = "contentPath=MyWebSiteName,computerName='https://fc-wapps-trial:8172/MsDeploy.axd?Site=WebSiteTest',Username=MyUsername,Password=MyPassword,AuthType=basic"
MSDeploy -verb:sync -source:$Source -dest:$Destination -allowUntrusted
This method also works fine.
Through MSDeploy.exe command line (within a Powershell script)
$Source = "contentPath='...._PublishedWebsites\MyWebApp'"
$Destination = "iisApp=MyWebSiteName/MyWebAppName,computerName='https://fc-wapps-trial:8172/MsDeploy.axd?Site=WebSiteTest/MyWebAppName',Username=MyUsername,Password=MyPassword,AuthType=basic"
MSDeploy -verb:sync -source:$Source -dest:$Destination -allowUntrusted
This method doesn't work. I am getting the following error.
Error Code: ERROR_USER_UNAUTHORIZED
More Information: Connected to the destination computer ("MyServerName") using the Web Management Service, but could not authorize. Make sure that you are using the correct user name and password, that the site you are connecting to exists, and that the credentials represent a user who has permissions to access the site.
Error: The remote server returned an error: (401) Unauthorized.
I was looking at what is the actuall MSDeploy command that the method 2 uses and I got something like:
msdeploy.exe
-source:manifest='...\MyWebApp.SourceManifest.xml'
-dest:auto,ComputerName='https://MyServerName:8172/MsDeploy.axd?site=WebSiteTest',UserName='MyUsername',Password='MyPassword',IncludeAcls='False',AuthType='Basic'
-verb:sync
-disableLink:AppPoolExtension
-disableLink:ContentExtension
-disableLink:CertificateExtension
-skip:objectname='dirPath',absolutepath='...\App_Data$'
-setParam:kind='ProviderPath',scope='IisApp',match='^...\PackageTmp$',value=WebSiteTest/WebAppTest
-setParam:kind='ProviderPath',scope='setAcl',match='^..\PackageTmp$',value=WebSiteTest/WebAppTest
-allowUntrusted
-retryAttempts=2
Now this doesn't seem to be anything close to what I am using in method 4. I tried running it myself without success, but I assume I wasn't able to properly re-create all those parameters.
So my questions are:
- What I am doing wrong in method 4?
- How can I deploy a web application as a website application in IIS7 using MSDeploy.exe command
Thanks in advance for your help
Iulian
I ran into the same issue as you did. I solved it by only use site name in
https://computername:8172/msdeploy.axd?site={websitenameonly}. Then set your webapplication path in the parameter using -setParam IIS Web Application Name= {your web application name here} or use a parameter file. And everything deployed fine.
It seems that the site querystring value is required to authorize the request only. I haven't find any definitive documentation from MS on any other querystring parameters that might solve this. But I actually tested 2 cases. 1) Deploying to a web site in IIS 7.5, this parameter is required. 2) Deploying to a web application under a web site, this parameter is actually optional, but if you want to include it, then it has to be a root site.
You actually answered your own question here just probably didn't realize it.
Please check your Management Service Delegation (if you haven't already). Click on the main site in IIS Manager to bring up all Web Deploy options in the center panel. At the bottom (past ASP.NET, IIS, etc), under Management, you should see several options, including "Management Service Delegation".
Under this configuration is all the Provider contexts you might run into and the paths/types you might use them against (and under what usernames, etc... can get pretty granular).
Make very sure that the provider type you're trying to communicate under (iisApp, contentPath, etc) is not only listed, but has the path/scope you require and that you're operating under permissions that have been cleared.
Remember: you don't have to use an administrator-type user if delegation is set up correctly. AND you've gone to the applicable site's IIS Manager Permissions and added an Allowed User, like Domain\User, or even a custom IIS Manager User.
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
After exploring Precompilation for Deployment topic I want to enhance my build process. Now, what I do is:
prepare web site using Web One Click Publish, for instance to c:\www\app directory, and that directory is available in IIS via app (localhost/app)
I launch aspnet_compiler.exe -v app c:\www\appprecompiled -f
Now I have ready precompiled application in c:\www\appprecompiled and everything is fine. However my application is quite big, and Publishing it (step 1) take about 5 minutes from scratch. So I wonder if it is possible to avoid step one , and perform step 2 (precompilation) with source folder pointing to solution folder. I tried something like this:
aspnet_compiler.exe -v codeapp c:\code\app -f
Where c:\code\app is the folder with web.config etc files, basically it's a project with web site and that folder is avaliable via http://localhost/codeapp.
But when launching that command, I get errors about missing global.asax or web.config errors:
C:\code\app\obj\debug\package\packagetmp\web.config(18):
error ASPCONFIG: It is an error to use
a section registered as
allowDefinition='MachineToApplication'
beyond application level. This error
can be caused by a virtual directory
not being configured as an
application in IIS.
And for the record, I use Application, not Virtual Directory.
So is there a way to perform precompilation on a plain web site folder?
I used
aspnet_compiler -p
physicalOrRelativePath -v / targetPath
from http://msdn.microsoft.com/en-us/library/ms227976(v=VS.80).aspx and removed obj folder prior to executing it, and precompilation works :)
Can anyone suggest the best way of moving websites on server1 with IIS7 to server2 with IIS 7.5 on it? I've read some articles which suggest copying the applicationHost.config file while preserving the configProtectedData node, but I'm concerned there may be settings in the IIS 7.5 config that don't exist in the current IIS7 config which would be lost.
I've also seen suggestions of moving each site individually by using a command like this:
AppCmd.exe LIST SITE "My Site" /config /XML > mysite.xml
This method just takes too long to do this for dozens of sites. There must be a better way of moving all the sites at once to the new platform.
I think I found the solution that worked best for me. You need to export the shared configuration from BOTH 7.0 and 7.5 servers. Copy the exported 7.0 files to a temp directory on the 7.5 server. On the 7.5 server, copy the exported 7.5 administration.config file over the top of the 7.0 file, thereby replacing it. In IIS 7.5, point your shared configuration to the temporary directory. The point here is to use the administration.config from the new server and not from the 7.0 server. Been working great for me since. The problem seems to stem from the node moduleProviders in this file. They are all version 7.0.0.0 in the file from IIS 7, which IIS 7.5 does not like.
Using Web Deploy is probably one of the simplest ways, you can do that directly to the live server, or you could do it to an offline package (zip file) and then apply at any time.
Download at: http://www.iis.net/download/WebDeploy
Simple command line like:
msdeploy.exe -verb:sync -source:apphostconfig="Default Web Site" -dest:apphostconfig="Default Web Site",computername=Server2 -whatif
-whatif tells it to just tell the differences that it would create, and If you remove it, it will apply all the changes to sync (if it does not exist it will create it).
Sample: http://learn.iis.net/page.aspx/446/synchronize-iis-7/
this is cool because it can bring also content files, COM objects, Assemblies in the GAC, registry keys, certificates, ssl bindings and more.
You can actually copy paste the complete appHost.config file except the <configProtectedData> section. Use windiff to compare the two appHost.config and then move the ones that are missing...Hope this helps.