我以前使用过IIS,但我从未使用过数据库,也从未完成过Web应用程序。我做了将站点放到IIS上的相同步骤,除了当我进入一个具有数据库连接的页面时,所有工作都一样。我已经尝试了很多,这是我得到的。在IIS数据库连接问题上托管ASP.NET Web应用程序
A network-related or instance-specific error occurred while establishing a >connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.
Windows应用程序事件日志:
Cannot get a local application data path. Most probably a user profile is not loaded. If LocalDB is executed under IIS, make sure that profile loading is enabled for the current user.
这个建于Visual Studio和我有一个SQL Express的数据库。 我发布了我的连接字符串,非常感谢任何帮助。
我已经加入这个我的applicationHost.config:
<add name="DefaultAppPool">
<processModel identityType="ApplicationPoolIdentity" loadUserProfile="true" setProfileEnvironment="true" />
现在我得到:
An attempt to attach an auto-named database for file |MY DB1 FILE| failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\DB1.mdf;Initial Catalog=aspnet-ICCAA_VIZIER-20150223043129;Integrated Security=True" providerName="System.Data.SqlClient"/>
<add name="ConnectionString" connectionString="Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\DB2.mdf;Integrated Security=True;Connect Timeout=30" providerName="System.Data.SqlClient"/>
什么了“请参阅Windows应用程序事件日志错误的详细信息。”揭露? –
无法获取本地应用程序数据路径。很可能用户配置文件未加载。如果LocalDB在IIS下执行,请确保为当前用户启用配置文件加载。 – Chetdu
您是否尝试过搜索错误? http://www.bing.com/search?q=Cannot+get+a+local+application+data+path.+Most+probably+a+user+profile+is+not+loaded.+If+LocalDB+ + IIS%2C下+执行+ + +制作+肯定是+模式+装载 –