加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – 在Windows Server 2012的Azure启动任务中安装功能

发布时间:2020-12-16 03:34:46 所属栏目:asp.Net 来源:网络整理
导读:我想在我的Azure部署中安装IP和域限制功能,但我使用的是os版本3(Server 2012),它已经弃用了ServerManageCmd,因此以下代码不起作用: StartupTask.cmd @echo off@echo Installing "IPv4 Address and Domain Restrictions" feature %windir%System32ServerMa
我想在我的Azure部署中安装IP和域限制功能,但我使用的是os版本3(Server 2012),它已经弃用了ServerManageCmd,因此以下代码不起作用:

StartupTask.cmd

@echo off

@echo Installing "IPv4 Address and Domain Restrictions" feature 
%windir%System32ServerManagerCmd.exe -install Web-IP-Security

@echo Unlocking configuration for "IPv4 Address and Domain Restrictions" feature 
%windir%system32inetsrvAppCmd.exe unlock config -section:system.webServer/security/ipSecurity

ServiceDefinition.csdef partial

<Startup>
      <Task commandLine="StartupStartupTasks.cmd" executionContext="elevated" taskType="simple" />
</Startup>

我相信我需要使用powershell命令,但我在这里有点不太深入.任何人都可以提供2012年此代码的等价物吗?

解决方法

对于那些在家里玩的人来说,这就是答案!

@echo off

@echo Installing "IPv4 Address and Domain Restrictions" feature 
powershell -ExecutionPolicy Unrestricted -command "Install-WindowsFeature Web-IP-Security"

@echo Unlocking configuration for "IPv4 Address and Domain Restrictions" feature 
%windir%system32inetsrvAppCmd.exe unlock config -section:system.webServer/security/ipSecurity

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读