VS2010 web deploy the connection string argument cannot be null or empty

Having problems deploying a website to an windows 2008 r2 server running IIS7. I have previously deployed another site to this server. The web deploy is connecting and copying my files to server but I see the following error(s).

1 The 'Connection String' argument cannot be null or empty
2   Web deployment task failed.((20/07/2012 14:19:16) An error occurred when the request was processed on the remote computer.)

(20/07/2012 14:19:16) An error occurred when the request was processed on the remote computer. Could not find a part of the path 'C:\Users\Me\Documents\Visual Studio 2010\Projects\MySite\MySiteClient\obj\Release\AutoScripts\EFDbContext-Deployment_SchemaOnly.sql'.     0   0   MySiteClient

I have verified that the path exists on my local machine.

I have tried publish with out web.config transforms and with using the xdt:transform functions to set the remote server strings.

I have also explicitly set the connection strings for both destination and source database in the Package/Publish SQL tab and am at a loss as to what the problem is.

Any ideas?

Answers


This was happening right now to me and I managed to isolate the problem... after manually adding a new SQL Server connection string in my Web.config I started experiencing this very error when trying to deploy to the remote server.

When I opened the web deploy Publish profile in Visual Studio 2012 I noticed under the Settings tab that it had set this option: Use this connection string at runtime (update destination Web.config).

Strangely this was setup automatically by VS 2012...

To solve the problem, just uncheck that checkbox and web deploy should start working again.


In addition to Leniel's answer, in case you are not using SqlClient or Entity Framework Code First and thus do not see the checkbox(es), temporarily set the providerName in your web.config's connection string to System.Data.SqlClient and then go back to your publish settings to uncheck the checkbox(es).


I was having the same issue:

2>C:...\Microsoft.Web.Publishing.targets(4270,5): Error : The 'db-Web.config Connection String' argument cannot be null or empty. 2>C:...\Microsoft.Web.Publishing.targets(4270,5): Error : The 'dbAudit-Web.config Connection String' argument cannot be null or empty. 2>C:...\Microsoft.Web.Publishing.targets(4270,5): Error : The 'dbLog-Web.config Connection String' argument cannot be null or empty.

as I was using:

<connectionStrings>
  <add name="db" providerName="MySql.Data" connectionString="server=mysql.gko.local;user=maindk;database=gavekortet;port=3306;password=123456" />
  <add name="dbLog" providerName="MySql.Data" connectionString="server=mysql.gko.local;user=maindk;database=logs;port=3306;password=123456" />
  <add name="dbAudit" providerName="MySql.Data" connectionString="server=mysql.gko.local;user=maindk;database=audit;port=3306;password=123456;pooling=false" />
</connectionStrings>

and as I read here the issue was regarding the publish profile, I then opened the .pubxml file and I've found:

<ItemGroup>
  <MSDeployParameterValue Include="$(DeployParameterPrefix)db-Web.config Connection String" />
  <MSDeployParameterValue Include="$(DeployParameterPrefix)dbAudit-Web.config Connection String" />
  <MSDeployParameterValue Include="$(DeployParameterPrefix)dbLog-Web.config Connection String" />
</ItemGroup>

add <UpdateDestWebConfig>False</UpdateDestWebConfig> to each node, so it will became:

<ItemGroup>
<MSDeployParameterValue Include="$(DeployParameterPrefix)db-Web.config Connection String">
  <UpdateDestWebConfig>False</UpdateDestWebConfig>
</MSDeployParameterValue>
<MSDeployParameterValue Include="$(DeployParameterPrefix)dbAudit-Web.config Connection String">
  <UpdateDestWebConfig>False</UpdateDestWebConfig>
</MSDeployParameterValue>
<MSDeployParameterValue Include="$(DeployParameterPrefix)dbLog-Web.config Connection String">
  <UpdateDestWebConfig>False</UpdateDestWebConfig>
</MSDeployParameterValue>
</ItemGroup>

simply by deleting this entry, everything was again working...


None of the provided solutions helped me.

I finally discovered that in my local Web.config, there was an empty default connection string called LocalMySqlServer (probably put there by the Mysql.Data NuGet package).

After I removed the highlighted line below I was able to successfully publish.


I had the same problem when i deployed a web application to an Azure web-server. I solved it by creating a new server. On that point i realized that there was another application on that server before. That application used a context-name that was not overritten by the second application so that one kept looking for a connectionstring that was overritten by the second application. I asume clearing your server might solve the problem.


I had exactly the same problem - right out of the blue on VS 2017.

Turns out that it was because I was running VS as Administrator. I closed the app down, restarted normally and all was back to normal.


Need Your Help

Is getElementById() method not available for tables

javascript html

I want to check if there exists an element with a particular id inside a table, below is my code.

Android Studio - sqlite insert does not work

android sqlite select insert

I created a table in an class and I insert the values from another class in the database.