MSDeploy setParameter not working

吃可爱长大的小学妹 提交于 2019-12-04 02:09:31
ShaneC

service_Address

I found the answer to this problem here:

Replace web.config elements with MSDeploy

I was missing 'text()' at the end of the XPath expression, the correct XPath is:

/configuration/applicationSettings/aim.Web.Properties.Settings/setting[@name='ai‌​m_Web_AddressService_Address']/value/text()


customErrorsMode

For the customErrorsMode problem, I was missing a '/' at the start of my XPath expression. The correct expression is:

/configuration/system.web/customErrors/@mode  


connectionStrings

This one really got to me, it was the last one I figured out. After doing a bit of digging I found out that MSDeploy automatically parameterizes certain elements, connection string being one of them, more info here:

Configuring Parameters for Web Package Deployment

My parameter declaration for the connection string in question should have been:

<parameter name="DbConnectionString-Web.config Connection String" defaultValue="">
    <parameterEntry kind="XmlFile" scope="\\web.config$" match="/configuration/connectionStrings/add[@name='DbConnectionString']" />
</parameter>

My setParameter definition should have looked like this:

<setParameter name="DbConnectionString-Web.config Connection String" value="Data Source=dbserver;Initial Catalog=DB1;Trusted_Connection=no;User ID=user1;Password=pass*9;" />
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!