To create a directory under and add a web app to IIS, I put this script in Azure DevOps Server Deployment Group job Powershell task:
New-Item -Path "C:\inetpub\wwwroot" -Name "MyNewApp" -ItemType "directory" `
C:\Windows\system32\inetsrv\appcmd.exe add app `
/site.name:"Default Web Site" `
/path:"/MyNewApp" `
/physicalPath:"C:\inetpub\wwwroot\MyNewApp"`
When this task runs it throws an error: (timestamps removed for clarity)
APP object "Default Web Site/MyNewApp" changed
ERROR ( hresult:80090016, message:Failed to commit configuration changes.
Keyset does not exist )
After executing the above code from a Powershell console while logged in as either myself or the service account, the following messages are returned:
APP object "Default Web Site/MyNewApp" added
VDIR object "Default Web Site/MyNewApp" added
I can confirm in IIS Manager that the directory and application was created.
I cannot reproduce the error in a console. It is only when it is running as the Release Agent and initiated through the DevOps Server web interface that this error occurs.
I have tried the following:
Keyset Issue - https://support.microsoft.com/en-us/help/977754/keyset-does-not-exist-error-message-when-you-try-to-change-the-identit for both the Local Service and service accounts.
Up-to Modify permissions on C:\inetpub\wwwroot for the service account
Adding the service account to IIS Manager Permissions
Update 1:
I determined the "Keyset does not exist" error was coming from trying to use the DefaultAppPool application pool as part of the setup. This application pool was not setup with the service account but was still set with default Application Pool Identity.
However, after making this change I have a new error:
APP object "Default Web Site/MyNewApp" changed
ERROR ( hresult:80070057, message:Failed to commit configuration changes.
The parameter is incorrect. )
...
Process 'appcmd.exe' exited with code '87'.
Any guidance is greatly appreciated.
Update 2:
I logged an issue with Microsoft community that is currently being looked at. You can see it here.
You could also look at the .net implementation with the servermanager:
https://learn.microsoft.com/en-us/iis/manage/scripting/how-to-use-microsoftwebadministration
https://learn.microsoft.com/en-us/dotnet/api/microsoft.web.administration.servermanager?view=iis-dotnet
Should not be very hard to use this in powershell.
Related
My requirement is as follows:
I have an web API whose port I have removed from the ServiceManifest.xml file. This is done so that I can implement multiple node multiple calls feature from API management. (i.e. I want to remove dependency on port number)
While deploying API management resource files, I am facing issues while deploying apim.json and apim.parameters.json file.
Following is the exception I am getting always.
"Service activation failed. Please look at the details in Activity Log on the left side. In case you are deploying into VNET please make sure prerequisites are followed as described on https://aka.ms/apiminvnet"
There is nothing in the log files when I am uploading.
I am using following link for the deployment and testing. https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-tutorial-deploy-api-management
I am getting exception in running powershell script
New-AzureRmResourceGroupDeployment -ResourceGroupName $groupname -TemplateFile "$templatepath\apim.json" -TemplateParameterFile "$templatepath\apim.parameters.json" -Verbose
Have a simple two-step release definition in Visual Studio Team Services / VSTS based on the "IIS Website Deployment" template set to configure an application pool (v4, integrated, application pool identity) and website (http, 192.168.0.xxx LAN IP, port 80, valid hostname) which is throwing an error I've struggled to find any details on. Isolated the issue to some AppCmd parameters but can't seem to remove them via the step settings.
Deploying out to a 2008 R2 target via VSTS agent v2.127.0 which installed without any issues but AppCmd consistently fails on the "IIS Web App Manage" step (after reconfiguring the application pool, creating a directory etc. without problems) then exits with code 8
hresult 80070008, Failed to commit configuration changes. Not enough storage is available to process this command.
Full log below but this line causes the error
"C:\Windows\system32\inetsrv\appcmd.exe" set site /site.name:"Example - Website Name" -applicationDefaults.applicationPool:"Example - AppPool Name" -[path='/'].[path='/'].physicalPath:"D:\Test\Example - Website Name" -[path='/'].[path='/'].userName: -[path='/'].[path='/'].password:
Running this directly on the target produces the same error, if I strip the blank username & password parameters it works. Checked we're not trying to set credentials and combinations of the authentication settings against the website and these two parameters won't either dissappear or format in a way which doesn't throw an error.
Tried searching for similar questions and it's lead nowhere, restarted the target in case it was a memory issue, even tried building a website-only step but the error remains.
##[section]Starting: Configure IIS AppPool & Website
==============================================================================
Task : IIS Web App Manage
Description : Create or update a Website, Web App, Virtual Directories, and Application Pool
Version : 0.5.4
Author : Microsoft Corporation
Help : [More Information](https://go.microsoft.com/fwlink/?linkid=839731)
==============================================================================
##[command]"C:\Windows\system32\inetsrv\appcmd.exe" list apppool /name:"Example - AppPool Name"
##[command]"C:\Windows\system32\inetsrv\appcmd.exe" set apppool /apppool.name:"Example - AppPool Name" -managedRuntimeVersion:v4.0 -managedPipelineMode:Integrated -processModel.identityType:ApplicationPoolIdentity
APPPOOL object "Example - AppPool Name" changed
##[command]"C:\Windows\system32\inetsrv\appcmd.exe" list site /name:"Example - Website Name"
##[command]"C:\Windows\system32\inetsrv\appcmd.exe" add site /name:"Example - Website Name" /physicalPath:"D:\Test\Example - Website Name"
SITE object "Example - Website Name" added
APP object "Example - Website Name/" added
VDIR object "Example - Website Name/" added
##[command]"C:\Windows\system32\inetsrv\appcmd.exe" set site /site.name:"Example - Website Name" -applicationDefaults.applicationPool:"Example - AppPool Name" -[path='/'].[path='/'].physicalPath:"D:\Test\Example - Website Name" -[path='/'].[path='/'].userName: -[path='/'].[path='/'].password:
SITE object "Example - Website Name" changed
ERROR ( hresult:80070008, message:Failed to commit configuration changes.
Not enough storage is available to process this command.
)
##[error]Process 'appcmd.exe' exited with code '8'.
##[section]Finishing: Configure IIS AppPool & Website
After discussing with MS Developer Support my problem appeared to be an issue with the target server's applicationHost.config encryption/security keys complicated by a less-than-useful error message being returned by AppCmd
The easiest way to verify the applicationHost.config being at fault was backing up the current config before reverting to an original, default copy of the applicationHost.config (C:\Windows\System32\inetsrv\config) then restarting the W3SVC service - was able to execute the "IIS Web App Manage" step without any issues afterwards.
Unfortunately keeping it reverted wasn't an option, so diffed the two versions of the config and found two keys with different sessionKey values in <configuration><configProtectedData><providers>
Copied the version of the highlighted keys (AesProvider & IISWASOnlyAesProvider) from our clean config to the current, restarted the W3SVC service and the same AppCmd line was able to run successfully.
Will continue to monitor as this was only happening on a physical internal development server with many potential ways the applicationHost.config could have accidentally changed while it's been in service - none of which should ever apply to a production system.
I am new to tfs-2018, I am trying to do deploy on one of my servers but getting below error in the log. I was able to deploy on other 2 systems but one system is giving the bellow error. Any help will be appreciated
Log:
2018-01-29T06:55:20.8002862Z ##[section]Starting: IIS Web App Manage
2018-01-29T06:55:20.8484384Z ==============================================================================
2018-01-29T06:55:20.8484384Z Task : IIS Web App Manage
2018-01-29T06:55:20.8484384Z Description : Create or update a Website, Web App, Virtual Directories, and Application Pool
2018-01-29T06:55:20.8484384Z Version : 0.4.4
2018-01-29T06:55:20.8484384Z Author : Microsoft Corporation
2018-01-29T06:55:20.8484384Z Help : More Information
2018-01-29T06:55:20.8484384Z ==============================================================================
2018-01-29T06:55:24.2725407Z ##[command]"C:\Windows\system32\inetsrv\appcmd.exe" list app "Default Web Site/PDM"
2018-01-29T06:55:24.4872952Z ##[command]"C:\Windows\system32\inetsrv\appcmd.exe" set app /app.name:"Default Web Site/PDM" -[path='/'].physicalPath:"E:\inetpub\wwwroot\PDM" -[path='/'].userName: -[path='/'].password:
2018-01-29T06:55:24.7066288Z APP object "Default Web Site/PDM" changed
2018-01-29T06:55:24.7066288Z ERROR ( hresult:80070057, message:Failed to commit configuration changes.
2018-01-29T06:55:24.7998202Z
2018-01-29T06:55:24.7998202Z The parameter is incorrect.
2018-01-29T06:55:24.7998202Z
2018-01-29T06:55:24.7998202Z )
2018-01-29T06:55:25.1905059Z ##[error]Process 'appcmd.exe' exited with code '87'.
2018-01-29T06:55:25.3169881Z ##[section]Finishing: IIS Web App Manage
Below is the configuration details attached.
I had similiar symptoms at one Windows Server 2012 R2 - on all other Windows Server 2012 R2 it would work.
Symptoms
"C:\Windows\system32\inetsrv\appcmd.exe" set app /app.name:"Default Web Site/foo" -applicationPool:"foo" -[path='/'].physicalPath:"C:\temp\foo" -[path='/'].userName: -[path='/'].password:
ERROR ( hresult:80070057, message:Failed to commit configuration changes.
The Parameter is incorrect.
)
We tried to figure out what was happening, and found that the appcmd.exe password Parameter would not work.
When omitting the password parameter the command would work fine:
"C:\Windows\system32\inetsrv\appcmd.exe" set app /app.name:"Default Web Site/foo" -applicationPool:"foo" -[path='/'].physicalPath:"C:\temp\foo" -[path='/'].userName:
Another symptom that led us to the root of the problem was:
specifying Physical Path credentials for a VirtualDirectory via the mgmnt-console would also not work.
Solution
For us, the problem was with a corrupt IIS Configuration Key. That prevented us from encrypting passwords in the applicationhost.config
We fixed the problem by importing the IIS Configuration Key from another test-machine.
Reinstalling IIS would have worked as well (if we ever had that problem on a production server)
Exporting the config key from a working IIS Server:
aspnet_regiis -px "iisConfigurationKey" "C:\temp\iisConfigurationKey.xml" -pri
Importing the config key at the renitent IIS Server:
aspnet_regiis -pi "iisConfigurationKey" "C:\temp\iisConfigurationKey.xml"
Replace AesProvider Element
Finally we replaced the AesProvider Provider Element from applicationHost.config
configProtectedData Section with the element from the working IIS Server and restarted the IIS.
Buried in there you will see The parameter is incorrect. which is what Microsoft’s standardized error code 87 means.
In my case the list of urls was wrong (I wasn’t delimiting them correctly with colons, or the wildcards were incorrect). Looking at yours, I don’t see an equivalent field. But try simplifying the fields you have specified until you get something working, then add the real values back gradually.
How do I change settings for a deployed application in Service Fabric?
I have a provisioned cluster and an application deployed to the cluster with two applications. I would like to be able to change my services' settings and have them pick up those changes, but I don't see how I can do that.
Previously, we've done all of our services with worker roles in Cloud Services, and the portal allows for changing configurations, but it does not appear to do so for Service Fabric. From the Service Fabric Explorer I can drill down to the service, go to MANIFEST and view the XML with the settings. I just don't see a way to edit or change it. I've struggled finding anything in the SF documentation addressing this.
The portal doesn't expose a way to do this. It needs to be done via an upgrade of the application. Just change the settings in your settings XML file and perform an upgrade. In the VS publish dialog for your application project, you can update your version numbers appropriately by changing the config package version which will automatically bubble up to update the containing service and application versions.
Building on Matt Thalman's answer, here's documentation on modifying the settings in the application or service manifest XML files, updating the version numbers, and performing an application upgrade: Service Fabric application upgrade tutorial using Visual Studio. You can also perform the app upgrade using PowerShell.
Additional to above answers, adding some powershell code..
we may use below powershell code to connect to Service Fabric from powershell and get the application parameters and then update specific parameter and re deploy..
### Change the connection here (from Profile-Cloud.xml
$ConnectArgs = #{
ConnectionEndpoint="devxxxxxx.westus.cloudapp.azure.com:19000"
X509Credential="true"
ServerCertThumbprint="52BFxxxxxxxxxx"
FindType="FindByThumbprint"
FindValue="EF3A2xxxxxxxxxxxxxx"
StoreLocation="CurrentUser"
StoreName="My"
}
Connect-ServiceFabricCluster #ConnectArgs
$myApplication = Get-ServiceFabricApplication -ApplicationName fabric:/ABC.MyService
$appParamCollection = $myApplication.ApplicationParameters
### Update your parameter here..
$applicationParameterMap.ElasticSearch_Username="sachin2"
$applicationParameterMap = #{}
foreach ($pair in $appParamCollection)
{
$applicationParameterMap.Add($pair.Name, $pair.Value);
}
### Start Udpating
Start-ServiceFabricApplicationUpgrade -ApplicationName $myApplication.ApplicationName.OriginalString -ApplicationTypeVersion $myApplication.ApplicationTypeVersion -ApplicationParameter $applicationParameterMap -Monitored -FailureAction Rollback -ForceRestart $true
### Check the status until it is Ready
(Get-ServiceFabricApplication -ApplicationName fabric:/ABC.MyService).ApplicationStatus
### Check the parameters to confirm those're updated
Get-ServiceFabricApplication -ApplicationName fabric:/ABC.MyService
You may change or remove the -ForceRestart as per your requriements
hi I am trying several ways to configure app url, but no luck, i am trying 1.started all services like app management service,managed meta data services,Microsoft SharePoint Foundation Subscription Settings Service Application,2.and giving full controls permissions
Check that those service application are running by browsing them like this :
http://[HOST]:[PORTNUMBER]/[PoolAppId]/SubscriptionSettings.svc for Subscription Settings Service Application
http://[HOST]:[PORTNUMBER]/[PoolAppId]/AppMng.svc for App Management Service Application
because sometimes the Central Administration tells you that the services are running, but you find error logs in the event viewer saying something like the message below, to inform that your server needs more ressources to activate all services :
Error source : System.ServiceModel 4.0.0.0
WebHost failed to process a request ....
Exception : System.ServiceModel.ServiceActivationException: the service '/c720557bd2fa437c94391bd06bdb4d44/XXXXXX.svc' can't be activated due to an exception in the compilation phase.
If your server hasn't enough RAM memory, you can edit the web.config file of the desired service by modifying the balise and including this one :
<serviceHostingEnvironment minFreeMemoryPercentageToActivateService="1"/>
hope this will help you !