asp.net MSDeployEnableWebConfigEncryptRule不加密的web.config [英] asp.net MSDeployEnableWebConfigEncryptRule fail to encrypt web.config

查看:594
本文介绍了asp.net MSDeployEnableWebConfigEncryptRule不加密的web.config的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经加入<$c$c><MSDeployEnableWebConfigEncryptRule>true</MSDeployEnableWebConfigEncryptRule>为了网络加密的配置文件来.pubxml文件。然而,在发布时,我得到了下面的错误。我不知道是否有比插入其它的web.config文件需要额外的设置<$c$c><MSDeployEnableWebConfigEncryptRule>true</MSDeployEnableWebConfigEncryptRule>在.pubxml

I have added <MSDeployEnableWebConfigEncryptRule>true</MSDeployEnableWebConfigEncryptRule> to .pubxml file in order to encrypt web config file. However, when publishing, i got the following error. I do not know whether there is extra setting needed in the web.config file other than inserting <MSDeployEnableWebConfigEncryptRule>true</MSDeployEnableWebConfigEncryptRule> in .pubxml

错误:
Web部署任务失败(不加密目的地的web.config了解更多:http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FAILED_TO_ENCRYPT_WEB_CONFIG.)

注:#ERROR_FAILED_TO_ENCRYPT_WEB_CONFIG没有出现在任何地方给定链路上的

Note: #ERROR_FAILED_TO_ENCRYPT_WEB_CONFIG does not appears anywhere on the given link.

我怎么能解决这个问题? (注:我不希望$ P $发布之前,当地对加密的web.config文件)

How could i resolve this error? (note: i do not wish to pre-encrypt the web.config file locally before publishing it)

推荐答案

这个问题似乎是,MSDeployEnableWebConfigEncryptRule不具有多个web.config文件中MVC项目。通常情况下MVC项目有查看/ Web.Config文件。这似乎像MSDeploy的错误。结果
我的解决办法是有一个部署后PowerShell脚本到目标服务器上执行相同的命令。请参见 http://www.iis.net/学习/出版/使用的Web部署/网络部署,PowerShell中的cmdlet

The problem seem to be that MSDeployEnableWebConfigEncryptRule doesn't work with MVC project that have multiple web.config files. Typically MVC project has Views/Web.Config file. This seems like a bug with MSDeploy.
My Workaround is to have a post deployment powershell script to perform same command on the destination server. See http://www.iis.net/learn/publish/using-web-deploy/web-deploy-powershell-cmdlets

PowerShell脚本示例:

Powershell Script Sample:

    Add-PSSnapin WDeploySnapin3.0
    $cmd = '%windir%\Microsoft.NET\Framework\v4.0.30319\ASPNET_REGIIS.exe -{0} {1} "{2}"' -f 'pef', 'connectionStrings', $destinationFolder
    New-WDPublishSettings -UserId $UserName -Password $Password -ComputerName $destination -AllowUntrusted -FileName server.publishsettings -AgentType MSDepSvc -Site $Website
    Invoke-WDCommand -Command $cmd  -DestinationPublishSettings server -Verbose

这篇关于asp.net MSDeployEnableWebConfigEncryptRule不加密的web.config的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆