我正在使用VS2012并且在发布mvc4网站时遇到了一些麻烦。
我的发布设置均未应用。
在我的配置中我有这个
的Web.Config
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880" name="***" enableCrossAppRedirects="true" />
推出
<?xml version="1.0"?>
<!-- For more information on using Web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings>
<add key="ApiBaseUrl" value="https://api.mydomain.com/api/" xdt:Transform="Replace" xdt:Locator="Match(key)" />
</appSettings>
<!--
In the example below, the "SetAttributes" transform will change the value of
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
finds an atrribute "name" that has a value of "MyDB".
<connectionStrings>
<add name="MyDB"
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
-->
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
<authentication mode="Forms" xdt:Transform="Replace">
<forms loginUrl="~/Account/Login" timeout="2880" name="***" enableCrossAppRedirects="true" domain="www.mydomain.com"/>
</authentication>
<!--
In the example below, the "Replace" transform will replace the entire
<customErrors> section of your Web.config file.
Note that because there is only one customErrors section under the
<system.web> node, there is no need to use the "xdt:Locator" attribute.
<customErrors defaultRedirect="GenericError.htm"
mode="RemoteOnly" xdt:Transform="Replace">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
-->
</system.web>
<system.net>
<mailSettings>
<smtp xdt:Transform="Replace">
<network host="localhost"/>
</smtp>
</mailSettings>
</system.net>
<dotless xdt:Transform="Replace" minifyCss="true" cache="true" web="false" />
</configuration>
我在发布时正在发布。
任何人都可以看到我做错了吗?
答案 0 :(得分:0)
在“Web发布向导”中检查“发布配置文件”。在VS2010中,web.config转换是根据发布时选择的构建配置应用的,但是使用新的Web发布向导我相信它存储在发布配置文件内部。我相信它是VS2012中包含的那个
答案 1 :(得分:0)
如果您的web.config包含位置标记,则还需要确保在发布配置中考虑这些标记。