在此之前,我必须向你们保证,这不是因为错误的连接字符串,我已经多次检查和测试过了!
所以在这里,显然这是一个众所周知的问题,很多人建议“纠正”连接字符串,但显然这不是我的解决方案。 我已经使用VS2013 Web Deploy工具在我从OVH(加拿大)购买的Windows 2012R2服务器上将我的Asp.NET MVC应用程序部署到iis。
所以这是web.config文件:
> <?xml version="1.0" encoding="utf-8"?> <configuration>
> <configSections>
> <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection,
> EntityFramework, Version=6.0.0.0, Culture=neutral,
> PublicKeyToken=b77a5c561934e089" requirePermission="false" />
> </configSections> <connectionStrings>
> <add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=TakeOutMaster;User
> Id=TakeOutMaster;Password=TakeOutMaster"
> providerName="System.Data.SqlClient" />
> <add name="DefaultConnection_DatabasePublish" connectionString="DefaultConnection_DatabasePublish.ConnetionString"
> providerName="System.Data.SqlClient" /> </connectionStrings>
> <appSettings>
> <add key="webpages:Version" value="3.0.0.0" />
> <add key="webpages:Enabled" value="false" />
> <add key="ClientValidationEnabled" value="true" />
> <add key="UnobtrusiveJavaScriptEnabled" value="true" /> </appSettings> <system.web>
> <authentication mode="None" />
> <compilation targetFramework="4.5.1" />
> <httpRuntime targetFramework="4.5.1" />
> <machineKey decryptionKey="8D764AB26980185F882E96A9E35C32593F1DFA124BE2C65E"
> validationKey="CE57D7D27468AC41982F44B71625B1513A1BCDDBC2B2084F3F1D68D618F095BFD53B3A76613AF7E7F5C1518D869DB1FB5F70053B82901DCF539D5103D274FC2D"
> validation="SHA1"/> </system.web> <system.webServer>
> <modules>
> <remove name="FormsAuthentication" />
> </modules> </system.webServer> <runtime>
> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
> <dependentAssembly>
> <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" />
> <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
> </dependentAssembly>
> <dependentAssembly>
> <assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" />
> <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
> </dependentAssembly>
> <dependentAssembly>
> <assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" />
> <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
> </dependentAssembly>
> <dependentAssembly>
> <assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" />
> <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
> </dependentAssembly>
> <dependentAssembly>
> <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
> <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
> </dependentAssembly>
> <dependentAssembly>
> <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
> <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
> </dependentAssembly>
> <dependentAssembly>
> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
> <bindingRedirect oldVersion="1.0.0.0-5.2.2.0" newVersion="5.2.2.0" />
> </dependentAssembly>
> <dependentAssembly>
> <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
> <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
> </dependentAssembly>
> <dependentAssembly>
> <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
> <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
> </dependentAssembly>
> <dependentAssembly>
> <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
> <bindingRedirect oldVersion="1.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
> </dependentAssembly>
> </assemblyBinding> </runtime> <entityFramework>
> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory,
> EntityFramework" />
> <providers>
> <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices,
> EntityFramework.SqlServer" />
> </providers>
> <contexts>
> <context type="TakeOutMaster.Models.ApplicationDbContext, TakeOutMaster">
> <databaseInitializer type="System.Data.Entity.MigrateDatabaseToLatestVersion`2[[TakeOutMaster.Models.ApplicationDbContext,
> TakeOutMaster], [TakeOutMaster.Migrations.Configuration,
> TakeOutMaster]], EntityFramework, PublicKeyToken=b77a5c561934e089">
> <parameters>
> <parameter value="DefaultConnection_DatabasePublish" />
> </parameters>
> </databaseInitializer>
> </context>
> </contexts> </entityFramework> </configuration>
当我在服务器上尝试应用程序时,出现以下错误:
format of the initialization string does not conform to specification starting at index 0
有什么想法吗?我花了一整天时间仍然坚持......