我对 ASP.NET 相当陌生,并且在尝试发布我的应用程序时遇到了以下问题。当我单击“打包/发布 SQL”按钮,然后继续尝试从我的 web.config 文件中导入数据库条目时,我收到一条错误消息,显示为“在 web.config 中找不到连接字符串”
如您所见,我的 Web.config 中有连接
任何帮助将不胜感激。
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=152368
-->
<configuration>
<appSettings>
<add key="webpages:Version" value="1.0.0.0"/>
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
</appSettings>
<connectionStrings> <!--<clear/>
<remove name="LocalSqlServer"/>-->
<add providerName="System.Data.SqlClient" name="LocalSqlServer" connectionString="server=mydatabase\SqlExpress; database=AssetManager.Models.AssetManagerContext; Integrated Security=SSPI " />
</connectionStrings>
<system.web>
<globalization culture="auto" uiCulture="auto" />
<roleManager enabled="true" />
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<authentication mode="Forms">
<forms loginUrl="~/Calendar/Index?showLogin=1" timeout="2880" />
</authentication>
<membership defaultProvider="AssetManagerMembershipProvider">
<providers>
<clear/>
<add name="AssetManagerMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="LocalSqlServer"
enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="true"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
applicationName="/" />
</providers>
</membership>
<profile inherits="AssetManager.Models.ProfileModel" defaultProvider="AssetManagerProfileProvider">
<providers>
<clear/>
<add name="AssetManagerProfileProvider" type="System.web.Profile.SqlProfileProvider" connectionStringName="LocalSqlServer"/>
</providers>
</profile>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages"/>
</namespaces>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.net>
<mailSettings>
<smtp from="nathandavies.markdrummond@email.com">
<network
host="smtp.gmail.com"
port="587"
password="!password"
userName="nathandavies.markdrummond@email.com"
/>
</smtp>
</mailSettings>
</system.net>
</configuration>