Recreating user, IIS application pool and website error - deployment

We are creating windows user, application pool using this user and website using the application pool in IIS 7, but if we delete these after creation and recreate them again the application pool start fails with the following error:
The Windows Process Activation Service failed to create a worker process for the application pool 'TestUserPool'. The data field contains the error number.
The Event ID is 5022 and the error number 80070005 which means ERROR_ACCESS_DENIED as we found here
The strange thing is that changing the pool name, changing the application pool user or restarting the IIS fixes the problem. We had this issues when doing all this programmatically, but the same thing cannot be reproduced manually.
The problem is that we need to add this functionality to an installer, but if you uninstall the site and then reinstall you will receive "Service Unavailable" until you restart your IIS server.
Thanks in advance!

Related

Failed to start service VisualStudioRemoteDeployer

We are using on site Dev-Ops and have a similar problem to that described in the link Example from SO.
But ours is intermittent.
Our environment uses two build and deploy machines, which each deploy machine having two worker agents.
For one of our projects, when it is deployed, we constantly get the error:
The VisualStudioRemoteDeployerc4d3852f-411b-48ba-97d8-5e09c8d07ce4 service failed to start due to the following error:
%%2
But here is the rub, not every time. Sometimes the deployment completes without error.
Other projects that use the same deployment machine and the same target server work each and every time without fail.
The deployment log reports "The WSMan provider host process did not return a proper response." as an error.
Checking the allocated memory, described in PowerShell Out of Memory, to find our set at 2.1 Billion.
This is an interesting issue that I have uncovered. The source of this problem stems from the interaction of McAfee Endpoint security.
Said antivirus was reporting that when the remote powershell script, using WSMan, was called. McAfee, saw this as a viral payload and canceled the deployment by stopping the service from running and deleting the payload. This has been reported to McAfee as an issue. In the mean time, internal network security settings for McAfee has had to be modified to ignore the processes used by powershell in remote deployment.

How to recreate an Agent Pool with the old name in AzureDevOps?

I have troubles creating a new agent pool in AzureDevOps.
What I wanted to do was to remove an old Self-Hosted host and deploy a new one. However, the Agent-Pool used by the old host and to be used by the new one was created by a co-worker. This let to the case that I was unable to remove the existing registered agents causing conflicts during deployment of the new host. To resolve this issue I was able to remove the agent pool.
Now, when I want to create a new pool with the same name, I get the error message
"No agent pool found with identifier 76".
Did anybody ever see this error message and or has an idea what I can do about it?
Expected:
A new agent pool with the same name as the old pool is created.
Actual:
I receive the error message "No agent pool found with identifier 76".
Agent creation Image
Error Message Image
So apparently if you delete the Agent-Pool via the Project-settings menu, they are still available under the Organization-Settings menu. 
If this pool belonged to somebody else, you seem to loose even a reader role on this group there. In other words, it appears as the group is deleted even though it really isn't. 
It's very unfortunate the error message does not actually tell you these exactly.
The solution for us was that the Organization-Admins made us as Administrators of the group again. Following I was able to clean it up under Organization-Settings and use it again.​
As discuss some details with A.S. and test on my side, I have figure it now.
The root cause of this error is that your account is not a Administrator role. You can check this message from this doc.
If you are one of PCA, even though you are Reader of this agent pool or not any role, you can still add agent pool. And the other solution I found is that you need be added as the Administrator of this agent pool instead of be as one of PCA. You must meet one of the above two solutions, can add it without any error.
In addition, for error message displayed in pages and in F12 console.
As you can see from the pic I mentioned, this caused the error message which showed in pages. I know, the error message of console is easy to misunderstanding. It let you confusing why it response 404 not found.
This still relevant with Administrator role.
https://dev.azure.com/{org name}/3307xxxxxxx5676e/_apis/distributedtask/queues?authorizePipelines=true
This api which showed in console is used to search agent pool under Org setting.
While you are not administrator of org/agent pool, it could not find out the agent pool you want to operate, because you don't have permission to search it under Org setting. And then, it says "sorry, 404 not found", even though it exist under org setting. This is not a bug, just for logic.
So, agree with you, the error message it not too clear to understand the root cause.
In addition, if you just delete the agent pool under project setting, it still exist under org setting. Just need administrator role, you can add it back again without any error.

WindowsIdentity throwing a "There are currently no logon servers available to service the logon request"

The code below works fine when running from a Console C# application:
System.Security.Principal.WindowsIdentity wi = new System.Security.Principal.WindowsIdentity("User001");
but when I try to add it into a class inside my web application I get:
{There are currently no logon servers available to service the logon request}
at System.Security.Principal.WindowsIdentity.KerbS4ULogon(String upn)
at System.Security.Principal.WindowsIdentity..ctor(String sUserPrincipalName, String type)
at System.Security.Principal.WindowsIdentity..ctor(String sUserPrincipalName)
...
I am assuming this is related to Kerberos and since Web Applications run under an Application Pool I wonder if I need to register a SPN or do something extra here to get this to work(for the local Account).
The console app runs under my DOMAIN\USER001 and
the Web app (App Pool) runs under MY_LOCAL_MACHINE\USER001
so I am trying to verify if I need to run SetSPN.exe or not and what is the command line.
Thank you
I had the same issue in my 2008R2 VM running SP2010 with a backend WCF service. In the service I was calling
WindowsIdentity id = new WindowsIdentity("MyApplicationUser");
You need to make sure your NetLogon service is running. If you are running a VM, you will need to configure the DNS role in order for this service to start. Once I did this, my code worked.

MSMQ won't enable on windows 7 machine

I'm trying to enable MSMQ on my development computer (running Windows 7).
I go to turn windows features on or off -> Microsoft Message Queue (MSMQ) Server Core -> Check MSMQ Active Directory Domain Services Integration AND MSMQ HTTP Support.
When I click OK, I get the error "An Error has occurred. Not all of the features were successfully changed." -> Click OK -> "You must restart your computer to apply these changes".
I've clicked Restart Now and Restart later and no matter what, same issue every time.
If I selected Restart later and go into Services...I see Message Queuing (stopped), and if I try to start the service, I get the error "Windows could not start the Message Queuing service on Local Computer. Error 0x80070005: Access denied."
I checked my privileges and I am an Admin on the machine. Just to be safe, I even logged into the machine as the actual Administrator. Same scenario.
Furthermore, when I go into the Event Viewer, I check the Application logs. I have an error with MSMQ as the Source. EventID: 2076, Error: The logger files cannot be initialized. The file QMLog in the Msmq\Storage folder is corrupted or absent. Error 0x80070005: Access denied.
If I check the System Logs, I see another error with the source being Service Control manager. Error eventId: 7023, Error: The Message Queuing service terminated with the following error: %%-2147024891
When I look up the error codes on Microsoft, there is NOTHING.
I had something like this - not sure how it came about as I always had AD integration turned ON for my MSMQ (as I needed it) but somewhere along the line, it got turned off and I couldn't turn it back on again via Control Panel - I would get the error behaviour (and restart!) that the OP describes. To fix it, I accessed my machine via the AD services manager app on one of our domain servers and deleted the "msmq" object that was under it.
I restarted my local MSMQ service on my machine AND rebooted (not sure which or both was required) and then when I checked my local registry entries, it indicated I was correctly running in AD mode once again. Everything started to work again after that.
This link was helpful in giving me the right direction to go in: Technet MSMQ delete stale objects article

Stopping the service and the babysited application before uninstalling

I have a service MyService.exe that is babysitting my application MyApp.exe, meaning it starts the application when this one crashes or whatever. Basically when the service is stopped the application is stopped (by the service) and when the service is started the application is started by the service.
In order to stop my service and by that my application when uninstalling I'm doing:
<ServiceControl Id='MyServiceControl' Name='MyServiceForTest' Start='install' Stop='uninstall' Remove='uninstall'/>
But when I want to uninstall everything I get the error message: "The setup must update files or services that cannot be updated while the system is running. If you choose to continue, a reboot will be required to complete the setup.". If I manually stop the service before running the uninstaller I don't get this msg as both my service and my application aren't then running anymore.
In the log file I noticed that this happens in InstallValidate and I get this message b/c of MyApp.exe being running.
I think what happens is: the uninstallers checks the running applications, it notices that the MyService.exe and MyApp.exe are both running, detects probably that the MyService.exe will be stopped by the uninstaller itself as instructed, but doesn't know about the MyApp.exe that this one will also be terminated once the service will be stopped so it will show the reboot-message.
I can't just close MyApp.exe from uninstaller b/c the service will restart it again.
How could I solve this problem so that the user won't need to reboot or to manually stop the service before doing an uninstall/upgrade? Also, I can't change MyService and MyApp code anymore so I will have to do this from the (un)installer only.
TIA,
Viv
I would expose a mechanism in your service in which your installer can instruct it to stand down and terminate the application. This way when Windows Installer costing looks for locked files it doesn't find any.