Given the following iis web.config
<sessionState customProvider="Foo" mode="Custom" timeout="90">
<providers>
<add name="FooProvider" type="Redis"/>
</providers>
</sessionState>
How would you change the values of <add name="FooProvider.. with appcmd?
I'm able to change the <sessionState customProvider>
appcmd.exe set config 'mycompany/mysite' -section:system.web/sessionState -customProvider:"bar" -timeout:90
But I don't know how to change <add name="FooProvider" to <add name="BarProvider"
I can delete the provider, and I can add a provider, however because I'm using CHEF to automate this, I need a way that is idempotent and can be run multiple times in a row.
Delete provider
appcmd set config 'mycompany/mysite' -section:system.web/sessionState /-"providers.[name='RedisSessionStateStoreProvider']
Create provider
appcmd set config 'mycompany/mysite' -section:system.web/sessionState /+"providers.[type='Redis',name='RedisSessionStateStoreProvider']"
Clear provider
appcmd clear config 'mycompany/mysite' -section:system.web/sessionState /providers
How can I modify the value of a provider without deleting and recreating it?
I don't believe this is possible, however I was able to work around it by using the fact that CHEF can do conditional "notify" of resources. I was able to preserve idempotence by only 'notifying' if the web.config file changes.
For reference, these are the commands that work.
Redis config
appcmd clear config 'MyCompany/mysite' '-section:system.web/sessionState'
appcmd.exe set config 'MyCompany/mysite' '-section:system.web/sessionState' '-mode:Custom' '-timeout:90' '-customProvider:RedisSessionStateStoreProvider'
appcmd set config 'MyCompany/mysite' '-section:system.web/sessionState' /+"providers.[name='RedisSessionStateStoreProvider',connectionString='10.10.10.10:6379,connectTimeout=5000,abortConnect=false,ssl=false',type='RedisAspNetProviders.SessionStateStoreProvider, RedisAspNetProviders']"
Sql config
appcmd clear config 'MyCompany/mysite' '-section:system.web/sessionState'
appcmd.exe set config 'MyCompany/mysite' '-section:system.web/sessionState' '-mode:SQLServer' '-allowCustomSqlDatabase:true' '-sqlConnectionString:network=dbmssocn; initial catalog=ASPState; user id=webfarmsession; connection lifetime=100;max pool size=200;data source=10.254.50.51; failover partner=10.254.50.50; password=xxxxxx' '-cookieless:false' '-timeout:90'
Related
I'm trying to run multiline command into the following script for urlrewrite https redirection under IIS through ansible playbook with the win_command but it shows error even i tried to put only the first command line into the win_command :
- name: configure https redirection urlrewrite
win_command: appcmd.exe set config "site1" -section:system.webServer/rewrite/rules /"[name='Redirect to HTTPS'].match.url:"(client*)""
appcmd.exe set config "site1" -section:system.webServer/rewrite/rules /+"[name='Redirect to HTTPS'].conditions.[input='{REQUEST_FILENAME}',matchType='IsFile']"
appcmd.exe set config "site1" -section:system.webServer/rewrite/rules /+"[name='Redirect to HTTPS'].conditions.[input='{REQUEST_FILENAME}',matchType='IsDirectory']"
appcmd.exe set config "site1" -section:system.webServer/rewrite/rules /"[name='Redirect to HTTPS'].action.type:"Rewrite""
appcmd.exe set config "site1" -section:system.webServer/rewrite/rules /"[name='Redirect to HTTPS'].action.url:"client/index.html""
You need to add one command before these executed, otherwise appcmd will not find rule. I have tested it and succeeded
appcmd.exe set config "site1" -section:system.webServer/rewrite/rules /+"[name='Redirect to HTTPS']"
I am new to Node.js and I have created a basic application in node.js and trying to deploy on Azure web App service.
After successful deployment, when I am trying to hit a website it showing me two types of error like You do not have permission to view this directory or page.
or website not responding.
In both cases, when I tried to trace the logs, it shows me following logs in the things you can try
If you do not want to enable directory browsing, ensure that a default document is configured and that the file exists.
Enable directory browsing using IIS Manager.
Open IIS Manager.
In the Features view, double-click Directory Browsing.
On the Directory Browsing page, in the Actions pane, click Enable.
Verify that the configuration/system.webServer/directoryBrowse#enabled attribute is set to true in the site or application configuration file.
How can I resolve the error?
You can try this approach:-
Create a web.config file at the root of the app directory.
Add the following code to web.config:
<configuration>
<system.webServer>
<!-- indicates that the index.js file is a node.js application
to be handled by the iisnode module -->
<handlers>
<add name="iisnode" path="index.js" verb="*" modules="iisnode" />
</handlers>
<!-- adds index.js to the default document list to allow
URLs that only specify the application root location,
e.g. http://mysite.antarescloud.com/ -->
<defaultDocument enabled="true">
<files>
<add value="index.js" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
Hope it helps. You can try enabling customerror=off to for troubleshooting exact error.For reference please follow:
Azure website message "You do not have permission to view this directory or page.". What to do?
MV
I am trying to deploy an Azure function project from Visual Studio 2017 to Azure but I am getting a proxy authentication error.
I have added the local proxy settings to Visual Studio config but still cannot get it to work.
<defaultProxy enabled="true" useDefaultCredentials="true">
<proxy bypassonlocal="True" proxyaddress=" HYPERLINK "http://<yourproxy:port#>"
http://<yourproxy:port#>"/>
</defaultProxy>
Is there anyway I can set the proxy in the JSON configuration similar to how it can be done in web application config to get around this problem?
I appreciate your help on this.
Thanks
I found a solution to this problem. If anyone has the same problem this may work for you
Add proxy settings for msdeploy.exe, you need to find it first (usually in C:\Program Files (x86)\IIS\Microsoft Web Deploy V3) and edit msdeploy.exe.config file
<system.net>
<defaultProxy useDefaultCredentials="true" />
</system.net>
In the publishing profile of your project (you can have multiple) which is located under your project > Properties > PublishProfiles, you need to add the following line so that it uses msdeploy.exe for publishing.
<UseMsdeployExe>true</UseMsdeployExe>
I've read a number of web articles explaining how to enabled Kerberos and NTML authentication. What is the process of removing these settings?
appcmd.exe set config "mysite" -section:system.webServer/security/authentication/windowsAuthentication /-"providers.[value='Negotiate']" /commit:apphost
appcmd.exe set config "mysite" -section:system.webServer/security/authentication/windowsAuthentication /-"providers.[value='NTLM']" /commit:apphost
Thanks!
Note here the -"providers... is to remove the settings, so if the above commands are executed, you would be first removing 'Negotiate' and then 'NTLM'
If you have additional other providers just add commands for the same and you would be able to remove the same.
Note: To add a new setting use +"providers... instead of -"providers... in the command.
Is there an appcmd for setting Load User Profile to false on DefaultAppPool on IIS7 via appcmd?
I have already tried this
%systemroot%\system32\inetsrv\appcmd set config -section:applicationPools /[name='DefaultAppPool'].processModel.loadUserProfile:false
But this only sets it for the defualt App Pool and doesnt change the main setting called "
Set Application pool defaults..."
You can do this with the following:
c:\windows\system32\inetsrv\appcmd.exe set config -section:applicationPools "/[name='appPoolNameGoesHere'].processModel.loadUserProfile:false"
c:\windows\system32\inetsrv\appcmd.exe set config -section:applicationPools "/[name='appPoolNameGoesHere'].processModel.loadUserProfile:true"