Note that there are some explanatory texts on larger screens.

plurals
  1. POWeb Deploy / Publish is adding a unknown connection string?
    primarykey
    data
    text
    <p>Previously publishing my web api app was working perfectly. Today i converted my app from being "any cpu" to x86. Now when i'm publishing its adding a connection string to the web config which is causing my app to fail. At first i though i maybe accidently adding something to the web.config transform file but nope i haven't. Here is my transform file:</p> <pre><code>&lt;configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"&gt; &lt;!-- In the example below, the "SetAttributes" transform will change the value of "connectionString" to use "ReleaseSQLServer" only when the "Match" locator finds an attribute "name" that has a value of "MyDB". &lt;connectionStrings&gt; &lt;add name="MyDB" connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/&gt; &lt;/connectionStrings&gt; --&gt; &lt;entityFramework xdt:Transform="Replace"&gt; &lt;defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"&gt; &lt;parameters&gt; &lt;parameter value="Server=MyWebServer;Database=RunLog;Trusted_Connection=True; MultipleActiveResultSets=True" /&gt; &lt;/parameters&gt; &lt;/defaultConnectionFactory&gt; &lt;/entityFramework&gt; &lt;system.web&gt; &lt;compilation xdt:Transform="RemoveAttributes(debug)" /&gt; &lt;!-- In the example below, the "Replace" transform will replace the entire &lt;customErrors&gt; section of your web.config file. Note that because there is only one customErrors section under the &lt;system.web&gt; node, there is no need to use the "xdt:Locator" attribute. &lt;customErrors defaultRedirect="GenericError.htm" mode="RemoteOnly" xdt:Transform="Replace"&gt; &lt;error statusCode="500" redirect="InternalError.htm"/&gt; &lt;/customErrors&gt; --&gt; &lt;/system.web&gt; &lt;/configuration&gt; </code></pre> <p>Here is my web config file:</p> <pre><code>&lt;!-- For more information on how to configure your ASP.NET application, please visit http://go.microsoft.com/fwlink/?LinkId=169433 --&gt; &lt;configuration&gt; &lt;configSections&gt; &lt;!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --&gt; &lt;section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt; &lt;/configSections&gt; &lt;system.web&gt; &lt;compilation debug="true" targetFramework="4.5" /&gt; &lt;httpRuntime targetFramework="4.5" /&gt; &lt;/system.web&gt; &lt;system.webServer&gt; &lt;handlers&gt; &lt;remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" /&gt; &lt;remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" /&gt; &lt;remove name="ExtensionlessUrlHandler-Integrated-4.0" /&gt; &lt;add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" /&gt; &lt;add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" /&gt; &lt;add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /&gt; &lt;/handlers&gt; &lt;/system.webServer&gt; &lt;entityFramework&gt; &lt;defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"&gt; &lt;parameters&gt; &lt;parameter value="Data Source=(localdb)\v11.0; Integrated Security=True; MultipleActiveResultSets=True" /&gt; &lt;/parameters&gt; &lt;/defaultConnectionFactory&gt; &lt;/entityFramework&gt; &lt;/configuration&gt; </code></pre> <p>Finally after i publish this is what my web config file looks like:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;!-- For more information on how to configure your ASP.NET application, please visit http://go.microsoft.com/fwlink/?LinkId=169433 --&gt; &lt;configuration&gt; &lt;configSections&gt; &lt;!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --&gt; &lt;section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /&gt; &lt;/configSections&gt; &lt;system.web&gt; &lt;compilation targetFramework="4.5" /&gt; &lt;httpRuntime targetFramework="4.5" /&gt; &lt;/system.web&gt; &lt;system.webServer&gt; &lt;handlers&gt; &lt;remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" /&gt; &lt;remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" /&gt; &lt;remove name="ExtensionlessUrlHandler-Integrated-4.0" /&gt; &lt;add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" /&gt; &lt;add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" /&gt; &lt;add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /&gt; &lt;/handlers&gt; &lt;/system.webServer&gt; &lt;entityFramework&gt; &lt;defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"&gt; &lt;parameters&gt; &lt;parameter value="Server=MyWebServer;Database=RunLog;Trusted_Connection=True; MultipleActiveResultSets=True" /&gt; &lt;/parameters&gt; &lt;/defaultConnectionFactory&gt; &lt;/entityFramework&gt; &lt;connectionStrings&gt; &lt;add name="RunLog" connectionString="RunLog_ConnectionString" providerName="System.Data.SqlClient" /&gt; &lt;/connectionStrings&gt; &lt;/configuration&gt; </code></pre> <p>If you look above you will see a connection string was added.</p> <p>After some research i found that you can add a connection string durinig publish. Well i've been publishing with the same profile so i deleted the profile multiple times and created a new one and made sure to uncheck the box to add a connection string: <img src="https://i.stack.imgur.com/5J32o.png" alt="Publishing"></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;!-- This file is used by the publish/package process of your Web project. You can customize the behavior of this process by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121. --&gt; &lt;Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt; &lt;PropertyGroup&gt; &lt;WebPublishMethod&gt;MSDeploy&lt;/WebPublishMethod&gt; &lt;SiteUrlToLaunchAfterPublish /&gt; &lt;MSDeployServiceURL&gt;http://MyWebServer&lt;/MSDeployServiceURL&gt; &lt;DeployIisAppPath&gt;My Web Site/Go&lt;/DeployIisAppPath&gt; &lt;RemoteSitePhysicalPath /&gt; &lt;SkipExtraFilesOnServer&gt;False&lt;/SkipExtraFilesOnServer&gt; &lt;MSDeployPublishMethod&gt;RemoteAgent&lt;/MSDeployPublishMethod&gt; &lt;UserName&gt;JohnBob&lt;/UserName&gt; &lt;_SavePWD&gt;False&lt;/_SavePWD&gt; &lt;PublishDatabaseSettings&gt; &lt;Objects xmlns=""&gt; &lt;ObjectGroup Name="RunLog" Order="1" Enabled="False"&gt; &lt;Destination Path="" /&gt; &lt;Object Type="DbCodeFirst"&gt; &lt;Source Path="DBContext" DbContext="RunLog.DL.RunLogContext, RunLog.DL" Origin="Convention" /&gt; &lt;/Object&gt; &lt;/ObjectGroup&gt; &lt;/Objects&gt; &lt;/PublishDatabaseSettings&gt; &lt;/PropertyGroup&gt; &lt;ItemGroup&gt; &lt;MSDeployParameterValue Include="$(DeployParameterPrefix)RunLog-Web.config Connection String"&gt; &lt;UpdateDestWebConfig&gt;False&lt;/UpdateDestWebConfig&gt; &lt;/MSDeployParameterValue&gt; &lt;/ItemGroup&gt; &lt;ItemGroup&gt; &lt;_ConnectionStringsToInsert Include="RunLog" /&gt; &lt;/ItemGroup&gt; &lt;/Project&gt; </code></pre> <p>As you can see there is connection stuff in there but i specifically unchecked "use this connection string at runtime (update destination web config). If i delete the connection string that was added my site works perfectly.</p> <p>Does anyone know whats going on?</p> <p>Edit:<br> I thought maybe i was doing doing something wrong but after working through it tonight i'm thinking it my be a bug. I decided to rollback all my code and see if i could reproduce the problem. Previously in the "Package/Publish Web" tab in properties the "Include all database configured in the Package/Publish SQL Tab: is selected. In the "Package/Publish SQL" Tab there is one connection string defined in "database entries" but its blank. If i leave it as is and try to publish everything works perfectly. If i delete the connection string and re-add it things get messed up again. In the dialog you see above if the database section is blank everything works correctly when your creating a profile but if it has remote connection string box then things wont' work correctly</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload