10

When I try to publish an azure app I get this error. C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.Publishing.targets(4283,5): Error : The 'ibasis_Data_Transfer.mytestdbEntities-Web.config Connection String' argument cannot be null or empty.

My App.Config has a connection string. e.g.

 <add name="mytestdbEntities" connectionString="metadata=res://*/mytestappModel.csdl|res://*/mytestappModel.ssdl|res://*/mytestappModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=tcp:srv-mytestapp-home.database.windows.net,1433;initial catalog=mytestdb;persist security info=True;user id=blabla;password=blabla;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

Don't know where to start looking for solution as error not mentioned on web anywhere in relation to azure.

ibasis - Web Deploy.pubxml

<?xml version="1.0" encoding="utf-8" ?>
<!--
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. 
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>MSDeploy</WebPublishMethod>
    <PublishProvider>AzureWebSite</PublishProvider>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish>http://ibasis.azurewebsites.net</SiteUrlToLaunchAfterPublish>
    <LaunchSiteAfterPublish>False</LaunchSiteAfterPublish>
    <MSDeployServiceURL>ibasis.scm.azurewebsites.net:443</MSDeployServiceURL>
    <DeployIisAppPath>ibasis</DeployIisAppPath>
    <SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
    <MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
    <UserName>$ibasis</UserName>
    <_SavePWD>True</_SavePWD>
    <_DestinationType>AzureWebSite</_DestinationType>
    <PublishDatabaseSettings>
      <Objects xmlns="">
        <ObjectGroup Name="ibasis_Data_Transfer.ibasisLiveEntities" Order="1" Enabled="False">
          <Destination Path="" />
          <Object Type="DbCodeFirst">
            <Source Path="DBContext" DbContext="ibasis_Data_Transfer.ibasisLiveEntities, ibasis-Data-Transfer" />
          </Object>
        </ObjectGroup>
      </Objects>
    </PublishDatabaseSettings>
  </PropertyGroup>
  <ItemGroup>
    <MSDeployParameterValue Include="$(DeployParameterPrefix)ibasis_Data_Transfer.ibasisLiveEntities-Web.config Connection String" />
  </ItemGroup>
  <ItemGroup>
    <_ConnectionStringsToInsert Include="ibasis_Data_Transfer.ibasisLiveEntities" />
  </ItemGroup>
</Project>

Update: As far as i can tell the VS publishing of simple Apps to Azure with 'database first' type entity(edmx) files is not possible.

The auto generated ....Web Deploy.pubxml gets filled with incompatible junk like and "DeployParameterPrefix" which can't be removed and break the build.

I only wanted to call simple Stored Procedure e.g.

 myappLiveEntities db = new myappLiveEntities();
 db.DoSomeDatabaseWork();

Will do it "old school" method.

3
  • Are you overwriting the connection string during publish? Do you have a configuration transform that is messing with the connection string? Commented Mar 15, 2016 at 0:15
  • _ConnectionStringsToInsert is probably doing something but not sure what. Is it a portal setting? The portal doesn't accept connection strings with this format: "metadata=res://*/mytestappModel.csdl|res......." Commented Mar 15, 2016 at 0:50
  • Possible duplicate of The 'DefaultConnection-Web.config Connection String' argument cannot be null or empty. VS2013 Commented Oct 18, 2016 at 3:49

2 Answers 2

5

I ran into this with a webjob I had been deploying successfully. I wound up deleting the pubxml file under the webjob project PublishProfiles folder and redoing the publish As Azure WebJob.

This issue popped up again when I upgraded to this specific nuget package: "Microsoft.WindowsAzure.ConfigurationManager" version="3.2.3" It may be an issue with publishing the webjob before publishing the updated web app or editing the WebApp publish settings ...

Edit: I've since switched to including the web job to the web app publish settings. You can do this by right clicking the project and choosing Add -> Existing Project as Azure Web Job. I no longer publish the WebJob separately.

Sign up to request clarification or add additional context in comments.

Comments

1

I believe you need to add a ParameterValue under the MSDeployParameterValue list item. For example,

<ItemGroup>
  <MSDeployParameterValue Include="Parameter Name">
    <ParameterValue>Parameter Value</ParameterValue>
  </MSDeployParameterValue>
</ItemGroup>

3 Comments

Such as? What "Parameter Name and value.?
Your database connection string.
In our case we used filler text (e.g. "Parameter Value" exactly as above). It stopped the error, and it wasn't applied to our App.Config (I'm guessing it was looking for a Web.Config, which our WebJob doesn't have).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.