Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The 'DefaultConnection-Web.config Connection String' argument cannot be null or empty. VS2013

When I deploy my project with "Publish as Azure WebJob" using Visual Studio 2013/update 4, I get the error in the title.

like image 330
RickAndMSFT Avatar asked Mar 11 '15 20:03

RickAndMSFT


2 Answers

Fixed by removing the following markup from the .pubxml file. You must exit/restart VS after removing the markup (or VS will add it back in).

<ItemGroup>   <MSDeployParameterValue Include="$(DeployParameterPrefix)DefaultConnection-Web.config Connection String" /> </ItemGroup> 
like image 170
RickAndMSFT Avatar answered Oct 15 '22 19:10

RickAndMSFT


Reason of the problem is one of the followings:

  1. Change the name of the connection string in the web.config.
  2. Add a new connection string in the web.config

Solution

  1. Select the website project, right-click on it, and click publish.

enter image description here

  1. Press the settings link and from the pop-up window select the 'Settings' Tab

  2. Uncheck the use this connection string at runtime from all your connection strings.

enter image description here

  1. Click the Save button to close the window. (No need to restart Visual Studio)
  2. Try to publish the website again, and it should publish without a problem.
  3. You can reconfigure the settings as it was previously, the unchecking just triggers VS to regenerate the .pubxml file, So you are not forced to change your settings at all.

NOTE
I am using VS 2017 (and according to the comments this also work in Visual Studio 2013)

Just for Note
After I did the previous steps, I noticed that the .pubxml file changed automatically. here is the difference which has been made (automatically without any interference from me)

So I think this is a better way because it is easier for the developer and also it let the visual studio to solve its problems himself, without forcing it into a specific thing.

enter image description here

like image 43
Hakan Fıstık Avatar answered Oct 15 '22 20:10

Hakan Fıstık