0

Everytime I do a commit and deploy(Publish) to Azure using MVC 4 or 5 in Visual Studio 2012 to my Azure Website which uses Azure SQL for my datasource (not sure what info is pertinent here). I get an Error when Visual Studio pulls up my website in the browser to test it.

Now the error below is what I get until I manually go back into Visual Studio and upload the Root Web.Config file. Which should have just been uploaded anyways. But once I upload that again by itself the errors go away.

Here is the error:

Error:

Format of the initialization string does not conform to specification starting at index 0.

Source Error:

    Line 12:     </div>
    Line 13: </div>
    Line 14: @Html.Action("Appraisers", "Partials")
    Line 15: </div>
    Line 16: <!-- End div class="row" -->

I can't post the entire stack trace here, I'm having problems doing so, but here are the first few lines from each error in the trace:

    [ArgumentException: Format of the initialization string does not conform to specification starting at index 0.]
    System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) +5314705
    System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +124
    System.Data.Common.DbConnectionOptions..ctor(String connectionString, Hashtable synonyms, Boolean useOdbcRules) +95
    System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +59
    System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +24
    System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +167
    System.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) +61
    System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +66
    System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings appConfigConnection) +122
    System.Data.Entity.Internal.LazyInternalConnection.Initialize() +62
    System.Data.Entity.Internal.LazyInternalConnection.get_Connection() +12
    System.Data.Entity.Internal.LazyInternalContext.get_Connection() +89
    System.Data.Entity.Infrastructure.DbContextInfo..ctor(Type contextType, DbProviderInfo modelProviderInfo, AppConfig config, DbConnectionInfo connectionInfo) +171
    System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration, DbContext usersContext) +240
    System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration configuration) +15
    System.Data.Entity.MigrateDatabaseToLatestVersion`2.InitializeDatabase(TContext context) +69
    System.Data.Entity.Internal.<>c__DisplayClasse`1.<CreateInitializationAction>b__d() +76
    System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +60
    System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() +337
    System.Data.Entity.Internal.LazyInternalContext.<InitializeDatabase>b__4(InternalContext c) +7
    System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input) +110
    System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action) +198
    System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase() +73
    System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +27
    System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +53
    System.Data.Entity.Internal.Linq.InternalSet`1.GetEnumerator() +15
    System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.Generic.IEnumerable<TResult>.GetEnumerator() +53
    System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +369
    System.Linq.Enumerable.ToList(IEnumerable`1 source) +58
    OrlandoAppraiser.Controllers.PartialsController.Appraisers() +34
    lambda_method(Closure , ControllerBase , Object[] ) +62
    System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14
    System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +157
    System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
    System.Web.Mvc.Async.AsyncControllerActionInvoker<BeginInvokeSynchronousActionMethod>b__36(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +22
    ...
    ...
    [HttpException (0x80004005): Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerAsyncWrapper'.]
    System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +3122279
    System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage) +76
    System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm) +28
    System.Web.HttpServerUtilityWrapper.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm) +19
    System.Web.Mvc.Html.ChildActionExtensions.ActionHelper(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues, TextWriter textWriter) +464
    System.Web.Mvc.Html.ChildActionExtensions.Action(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues) +83
    System.Web.Mvc.Html.ChildActionExtensions.Action(HtmlHelper htmlHelper, String actionName, String controllerName) +11
    ASP._Page_Views_Home_Index_cshtml.Execute() in c:\DWASFiles\sites\orlandoappraiser\VirtualDirectory0\site\wwwroot\Views\Home\Index.cshtml:14
    System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +198
    System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +104
    System.Web.WebPages.StartPage.RunPage() +17
    System.Web.WebPages.StartPage.ExecutePageHierarchy() +64
    System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +78
    System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +235
    System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +107
    System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +291
    System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13
    System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +56
    System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +420
    System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +52
    System.Web.Mvc.Async.<>c__DisplayClass28.<BeginInvokeAction>b__19() +173
    System.Web.Mvc.Async.<>c__DisplayClass1e.<BeginInvokeAction>b__1b(IAsyncResult asyncResult) +100
    System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
    System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
    System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27
    System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +13
    System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +36
    System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +54
    System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +39
    System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +12
    System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +28
    System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +54
    System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +29
    System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
    System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__4(IAsyncResult asyncResult, ProcessRequestState innerState) +21
    System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +36
    System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +54
    System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +31
    System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9631764
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

Sorry about all of that, but I wanted to make sure I gave as much info about the problem as possible.

Eric Bishard
  • 5,201
  • 7
  • 51
  • 75
  • Are you using AzureWebsites or WebRoles or VM? If AzureWebsite, how are you deploying? using publishsettings or source control integrated deployment? If publishsettings, then are you using WebDeploy or FTP? Can you try FTP with all files delete prior deployment? Also can you check the preview of the deployment before clicking on publish button? – ramiramilu Jan 21 '14 at 04:18

1 Answers1

0

That error is typically an indication that your connection string in your web.config is not formatted correctly. Are you doing any transforms of your web.config as part of deployment (e.g. changing the connection string on Release build)?

Brendan Green
  • 11,676
  • 5
  • 44
  • 76
  • Sorry I took so long. My local copy and my published copy of the website both use the same connection string which points to the Azure SQL DB. So even when I run it locally I'm dependent on the Azure DB. So nothing changes in that regard. – Eric Bishard Jan 21 '14 at 00:06
  • Maybe VS is constantly updating something in my web.config file that at publish time is problematic, but once it's done publishing the files it changes it and then when I upload manually it's oK? I'm confused, and it's not a huge problem but it bugs me. No pun intended. – Eric Bishard Jan 21 '14 at 00:11
  • @EricB - sounds like you have a web.config transformation that VS is processing when you publish your site. Your root "web.config" can be altered by the transformation. This would explain why it works locally but you have to reupload after a publish. Check your transformation files (they are under your web.config) and *ensure* nothing in there is changing your settings. – Tommy Jan 21 '14 at 04:47
  • What exactly am looking for? – Eric Bishard Jan 21 '14 at 05:43
  • Since the error is related to your connection string, it is probably worth while posting the relevant section... – Brendan Green Jan 21 '14 at 12:04