msdeploy: allowuntrusted is being ignored - windows-server-2008-r2

I have a machine [A] running fresh installation of Win2008 R2 which holds a webapp on IIS. I try to use msdeploy command line tool on machine [B] to publish a deployment package to this machine, but i keep on getting error regarding certificate.
I am using -allowuntrusted, but it still keeps on giving the same error.
I've been trying different things (like changing msdeploy port on IIS, installing certificate on the other machine, reinstall iis roles, tons of other) for 2 days now with absolutely no luck.
This is what I run:
msdeploy.exe -verb:sync -source:package="Web.zip" -dest:auto,ComputerName="https://machineA:8173/msdeploy.axd?site=app.com",UserName="AdminUser",Password="SecurePassword",AuthType="Basic" -allowUntrusted
To make things more interesting, this is what I get when I run the same command on the IIS-containing machine (even after changing dest to sync):
Error: A '-dest' argument must be specified with the 'sync' verb.
Error count: 1.
Any ideas?
EDIT:
I tried using the same settings (ip, package, authentication) in Visual Studio 2012 to create a publishing profile which deploys. After hitting "Verify connection", I got a popup asking if I want to accept this untrusted certificate. I clicked yes and went on to publish - that went through just fine.
Is there a way to get this behaviour with msdeploy command line? Using VS2012 is not an option for me, since publishing must be done automatically.
EDIT 2:
The fun continues: it works on another Windows Server 2008 R2 target machine (not a clean install though). So, where's the magic checkbox? :)

So, I managed to figure out 2 solutions:
Get a valid certificate (we had one in company, so playing around with hosts on machine [B] to match IP with company's domain, helped).
Place "-allowUntrusted:true" BEFORE "-dest" instead of at the end. No clue why does it work on one but not another machine.
Hope this helps someone to save some time :)

I see some problems with the command:
Unless you have changed the default port, you should be using 8172 and not 8173.
Secondly there is a double quote before securepassword but I don't see a closing double quote.
Your package most likely has some default parameters for which you must be specifying values during deployment.
msdeploy.exe -verb:sync -source:package="Web.zip" -dest:auto,ComputerName=https://machineA:8172/msdeploy.axd?site=app.com,UserName="AdminUser",Password="SecurePassword",AuthType="Basic" -allowUntrusted -setParam:paramname=value

Related

Access database from an application hosted on IIS

The error I get is:
Cannot open database "DBNAME" requested by the login. The login failed.\r\nLogin failed for user 'IIS APPPOOL\DefaultAppPool'
Initial connection string is as follows, further in the question I'll only be using only a part of it.
Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=DBNAME;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False;
I believe I have tried everything:
My application that is hosted on IIS is using a
'ApplicationPoolIdentity' as identity. I have tried changing the
identity to other, but to no avail. Only to be greeted by a similar
error, but with a changed user. (Havent tried using Custom account)
Tried sharing my localDB instance
with the following command sqllocaldb share mssqllocaldb IIS_DB.
Restarting the instance, changing my connection string data source
to the following (localdb)\\.\\IIS_DB.
Tried plainly using
SQLEXPRESS instance with the following data source .\\SQLEXPRESS.
I have added IIS APPPOOL\\DefaultAppPool user to all possible places, given full access to everything, allowed Everyone to access the folders where the database is located.
One thing I haven't tried is to try and repeat everything from scratch, since I might've messed something up. All help is appreciated.
IIS: version 10.0.19041.1
SSMS: version 18.12.1
Backend: .NET 6 minimal API + DAPPER
Thank you #Lex Li
I used to login to my PC via the microsoft acc and thus I never did use a windows acc. So whoever stumbles, keep in mind that it's easy to create the acc, windows helps you with that.
Other than that, what I was missing was exactly this. Use your own acc and not a DefaultAppPool (even though it should still work.).
Dont forget to check that your SQL instance is running:
Open cmd and write sqllocaldb i (this should show you all of your instances)
to check whether an instance is running. (It is started when you open your local SSMS and connect to your instance or you run it through cmd): Write sqllocaldb i instancename (should see it as running) - (if you want to restart it, write sqllocaldb stop instancename and then sqllocaldb start instancename.
Other than that, feel free to ask for help in the comments, I might remember this stuff even after a year or two. (Literally spent 7 days on this issue)

Klondike private NuGet repository api page responds with an HTTP 404.0 error

Using the instructions in this link and the "How to Deploy Klondike"
github instructions I have installed the Klondike release on my local IIS (Version 10.0.15063.0). At first it looked promising, but then I realized that the main page is showing "loading..." rather than the Klondike URL. See image:
Additionally the when I click the API page tab, the site navigates to http://localhost:8081/api which returns a 404.0 HTTP error. This error may not seem very surprising as the site's directory does not contain an api directory. However, I have reverse engineering a working server with Klondike configured on it and it also does not have the api directory. Here is an image of the 404.0 error:
Additionally, when I try to nuget pushto localhost:8081, it results with the error in the image here (note, the red blocked out text is the apikey).
Finally, I have left the handleLocalRequestsAsAdmin is set to true, but even though I am on localhost, it does not show me the "LocalAdministrator" link. I believe that all these symptoms are linked to the same issue.
I have tried the following with no affect on the behavior:
Putting this site in c:\inetpub\wwwroot and also in C:\Klondike;
Using different port numbers, such as 8081 and 80;
Putting a 127.0.0.1 alias in my hosts file and binding the value in IIS to the host name; and
Installed the Debugging tools for Windows install as was suggested on the github site and set the debuggingToolsPath to its path.
(at this point, I'm just guessing at the issue)
The settings I have changed in settings.config file are as follows:
packagesPath = C:\Klondike\App_Data\Packages
Left lucenePath = empty string (I also tried this with a value of C:\Klondike\App_Data\Lucene with no affect.
symbolsPath = C:\Klondike\App_Data\Symbols
debuggingToolsPath = C:\Program Files (x86)\Windows Kits\10\Debuggers\x64
ignorePackageFiles = "true"
I have not changed any values in the web.config file from the default web.config release values.
Thank you for any help that you can provide.
I ran into the same problem, although I was installing Klondike on a remote server rather than locally, but still IIS 10. The problem might be you don't have all the IIS components installed or enabled. More specifically, .NET or one of its required components might not be installed or enabled. If you look at the error on the /api link - it has to do with the MapRequestHandler and Static file handler in IIS - this indicates IIS doesn't know how to handle the request, which is an indicator you might be missing the ExtensionlessUrlHandler in IIS, as well as other components. To solve the problem, go to Start -> Control Panel -> Turn Windows features on or off (varies per system, might be under "Programs and Features"), then find the IIS Application Development Features. These might be listed under Internet Information Services -> World Wide Web Services, or Web Server (IIS) -> Web Server, depending on your system. Once you find these Application Development Features, make sure you have an ASP.NET option checked - you might just want to check all the options. Below is screenshot of what it looks like on my system. You might want to reboot after adding those features - not sure if a reboot is required, but it doesn't hurt. After you enable those features, you might start to run into all kinds of file permission errors when running the Klondike app - you might want to just remove Klondike and reinstall it from the zip file. I have a feeling it Klondike doesn't run cleanly the first time it has problems, as it needs to create an App_Data folder with sub directories.

msdeploy failure: IIS 7.5->8.5: Error: The ApplicationHost.config file is invalid / eventlog error 9000 on destination system

Using v7.1 (that is the ver at cmd prompt), 3.6 (from web platform installer) of msdeploy.exe
Migrating from Win2008-R2 IIS to Win2012-R2
Attempting to move everything IIS related over. (And yes, we have customized applicatiohost.config, but we do not know all the mods... that is why we are using a migration tool,,, to move everything...)
Command I am running:
C:\Program Files\IIS\Microsoft Web Deploy V3>msdeploy
-verb:sync -source:webserver,
computername=WIN-67E8GTGADGJ
-dest:webserver,computername=192.168.2.21,
userName="administrator",password="###"
output:
Info: Using ID '1d59e6bd-0f89-4479-9853-98e164c9f613' for connections to the rem
ote server.
Info: Using ID '0c99bd7f-faa3-4737-ac35-d65c495402b6' for connections to the rem
ote server.
Info: Adding MSDeploy.webServer (MSDeploy.webServer).
Info: Adding webServer (MSDeploy.webServer/webServer).
Info: Adding appHostConfig ().
Error: (8/24/2015 10:28:43 PM) An error occurred when the request was processed on the remote computer.
Error: The ApplicationHost.config file is invalid. Cannot proceed with synchronization.
Error count: 1.
MORE INFORMATION
The sequence of events is:
Target system logs one error event:
Microsoft-Windows-IIS-APPHOSTSVC -- message 9000
And then msdeploy on the source system throws (and msdeploy exits):
Error: (8/25/2015 4:36:50 PM) An error occurred when the request was processed on the remote computer.
Error: The ApplicationHost.config file is invalid. Cannot proceed with synchronization.
Error count: 1.
UPDATE: Initially I was getting TWO event log errors on target system. Message 9000 and 9012. I was able to fix the 9012 by extending the applicationhost.config file. But hours of work and no solution yet for the 9000 error.
I have examined the ApplicationHost.config, and compared it to baseline, and there really seems to be nothing special there.
What is the path to resolution?
The answer is that there seems to be real problems with msdeploy, but no one seems to understand (or document) why. The tool is primarily built to go from IIS 6.x (Win 2003) to newer IIS.
In our experience, when going from IIS 7.x to 8.x, you often cannot use msdeploy with "source:webserver" approach. However, msdeploy can do a lot of the lifting for you from 7.x to 8.x.
Here are some steps I have seen work:
First, do three steps. This will let msdeploy move as much as it can (would be nice if it could move more, but this is as far as I have seen work):
msdeploy -verbose -verb:sync -source:apphostconfig="WEB SITE NAME",computername=SOURCEMACHINE -dest:apphostconfig="WEB SITE NAME",computername=DESTINATIONMACHINE,userName="administrator",password="password-here" -enableLink:AppPoolExtension
Note the "enablelink" flag.
Repeat the above with:
-enableLink:CertificateExtension
and then
-enableLink:FrameworkConf
Once this is done, msdeploy has done all it can. You should now have the site migrated, with content and app pools, and ssl certs, and the configuration related to the sites and app pools.
For mime mappings, and other IIS system wide settings (compression is one example), you are on your own.
Don't ask me why there is no document on how to do this. (Don't ask me why msdeploy can't just do the whole freaking server. It works great from IIS 6, but not from IIS 7, like what kind of crazy is that? Anyway, send Satya an email about it.)

Running multiple sites at once with WebMatrix 2 without opening it up multiple times

Since I have began using WebMatrix, I have developed many of my organization's web-interface, intranet sites. I am now up to four, almost five sites running all at once for users to connect to, and I am afraid that opening up that many instances of the entire WebMatrix app may result in a waste of the server's resources.
I have been scouring the Internet for a reference to how to run multiple sites with WebMatrix. I haven't exactly come up empty handed, however, I haven't found a solution I like either (even though sources suggest this is entirely possible).
Even though I do know how to run multiple sites at once with WebMatrix (simply open up another instance of WebMatrix) my first question is: Isn't this more resource intensive (for the server using iis-express) then it needs to be? Is it beneficial to turn these sites on via command line over simply opening up several instances of WebMatrix?
Last Question: I found this article here...:
http://forums.asp.net/t/1677533.aspx/1
...where Mike Brind suggests that this can be done by using command-line to browse to the correct iis-express directory (for me: C:\Program Files (x86)\IIS Express) and using the command:
iisexpress /site:EmptySite1
Where EmptySite1 is the name of the site desired to be ran.
I get this error when trying this:
Command Line switches must be preceded by a '-' or '/'...
Any clue how I can run multiple sites at once from command-line, or if I even need to?
(Sorry I am in no way a command line guru, as I'm sure you can, by now, tell)
I am running Windows Server 2008 R2, if that matters.
Thanks for any help!
Since you are running full blown Windows Server 2008, install regular IIS. It can run multiple websites all at once without having any special command lines. Since it runs as a service, IIS will automatically restart if and when the server is rebooted. The downside is that IIS is a bit more complicated to configure than IIS express.

Is there a way to reset IIS 7.5 to factory settings?

I modified a lot of options in IIS, and would like to reset its settings to default.
I already tried installing/reinstalling it. After the reinstall, it still had the site I created. It was still breaking on the setting I made to the DefaultWebSite.
People suggested uninstalling Windows Process Activation Service first, but it seems like it wasn't installed anyway, so I can't really uninstall it.
How can I reset this installation of IIS back to an out-of-the-box state?
You need to uninstall IIS (Internet Information Services) but the key thing here is to make sure you uninstall the Windows Process Activation Service or otherwise your ApplicationHost.config will be still around. When you uninstall WAS then your configuration will be cleaned up and you will truly start with a fresh new IIS (and all data/configuration will be lost).
There are automatic backup under %systemdrive%\inetpub\history but it may not help much if you already made lots of changes.
http://blogs.iis.net/bills/archive/2008/03/24/how-to-backup-restore-iis7-configuration.aspx
You will have to regularly back up manually using appcmd.
If you try to reinstall IIS, please first uninstall IIS and WAS via Add/Remove Programs, and then delete all existing files under C:\inetpub and C:\Windows\system32\inetsrv directories. Then you can install again cleanly.
WARN: beginners on IIS are not recommended to execute the steps above without a full backup of the system. The steps should be executed with caution and good understanding of IIS. If you are not capable of or you have doubt, make sure you open a support case with Microsoft via http://support.microsoft.com and consult.
What worked for me was going to the article someone else had already mentioned, but keying on this piece:
application.config.backup is not created by automatic backup. The backup files are in %systemdrive%\inetpub\history directory. Automatic backup is also a Vista SP1 and above feature. More information can be found in this blog post, http://blogs.iis.net/bills/archive/2008/03/24/how-to-backup-restore-iis7-configuration.aspx
I was able to find backups of my settings from when I had first installed IIS, and just copy and replace the files in the inetsrv\config directory.
Source: http://forums.iis.net/t/1085990.aspx
There is one way that I have used my self. Go to Control Panel\Programs\Turn Windows features on or off then uninstall IIS and all of its components completely. I restart windows but I'm not sure if it's required or not. Then install it again from the same path.
This link has some useful suggestions:
http://forums.iis.net/t/1085990.aspx
It depends on where you have the config settings stored. By default
IIS7 will have all of it's configuration settings stored in a file
called "ApplicationHost.Config". If you have delegation configured
then you will see site/app related config settings getting written to
web.config file for the site/app. With IIS7 on vista there is an
automatica backup file for master configuration is created. This file
is called "application.config.backup" and it resides inside
"C:\Windows\System32\inetsrv\config" You could rename this file to
applicationHost.config and replace it with the applicationHost.config
inside the config folder. IIS7 on server release will have better
configuration back up story, but for now I recommend using APPCMD to
backup/restore your configuration on regualr basis. Example: APPCMD
ADD BACK "MYBACKUP" Another option (really the last option) is to
uninstall/reinstall IIS along with WPAS (Windows Process activation
service).
Resetting IIS
On the computer that is running Microsoft Dynamics NAV Web Server components, open a command prompt as an administrator as follows:
a. From the Start menu, choose All Programs, and then choose Accessories.
b. Right-click Command Prompt, and then choose Run as administrator.
At the command prompt, type the following command to change to the Microsoft.NET\Framework64\v4.0.30319 folder, and then press Enter.
cd\Windows\Microsoft.NET\Framework64\v4.0.30319
At the command prompt, type the following command, and then press Enter.
aspnet_regiis.exe -iru
At the command prompt, type the following command, and then press Enter.
iisreset

Resources