I am trying to setup a website and webjob, but get an error everytime I try to publish the webjob independently of the website (i.e. Selecting Publish as Azure WebJob
from the context menu)
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets(4270,5): Error : The 'MyWebJob.Models.MyDataEntities-Web.config Connection String' argument cannot be null or empty.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets(4270,5): Error : The 'MyWebJob.Models.MoreDataEntities-Web.config Connection String' argument cannot be null or empty.
There are two options for deploying a WebJob
When I link my webjob to a website project, it deploys with the website without error. However, when I try to deploy it independently I get the above error in my console and Error List, but the webjob is still deployed.
How can I deploy my webjob independently and get rid of this persistent "error"?
In Visual Studio, select File > New > Project. Under Create a new project, select Console Application (C#), and then select Next. Under Configure your new project, name the project WebJobsSDKSample, and then select Next. Choose your Target framework and select Create.
I found that providing a value for
<Destination Path="" />
in your publish profile pubxml file got rid of the issue. This can usually be found in \Properties\PublishProfiles. You probably have something like:
<PublishDatabaseSettings> <Objects xmlns=""> <ObjectGroup Name="Context" Order="1" Enabled="False"> <Destination Path="" /> <Object Type="DbCodeFirst"> <Source Path="DBMigration" DbContext="Context, DAO" MigrationConfiguration="Context.Migrations.Configuration, DAO" Origin="Convention" /> </Object> </ObjectGroup> </Objects> </PublishDatabaseSettings>
Changing it to the following fixed it for me:
<PublishDatabaseSettings> <Objects xmlns=""> <ObjectGroup Name="Context" Order="1" Enabled="False"> <Destination Path="{deployment connection string}" /> <Object Type="DbCodeFirst"> <Source Path="DBMigration" DbContext="Context, DAO" MigrationConfiguration="Context.Migrations.Configuration, DAO" Origin="Convention" /> </Object> </ObjectGroup> </Objects> </PublishDatabaseSettings>
Hope that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With