gpt4 book ai didi

c# - 应用程序 [Win32Exception (0x80004005) : The system cannot find the file specified] with model first EF

转载 作者:太空宇宙 更新时间:2023-11-03 20:15:09 26 4
gpt4 key购买 nike

我有一个小项目,我在其中使用了与 bitbucket 和 appharbor 的持续集成当我发布项目时,登录正常工作等等,但其他数据库连接出现以下错误:

The system cannot find the file specified Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

异常详细信息:System.ComponentModel.Win32Exception:系统找不到指定的文件

这是我的本地连接字符串

<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-ZeinyCenter-20130614160141;Integrated Security=SSPI;" providerName="System.Data.SqlClient" />
<add name="Model1Container" connectionString="metadata=res://*/Models.Model1.csdl|res://*/Models.Model1.ssdl|res://*/Models.Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=(LocalDb)\v11.0;initial catalog=aspnet-ZeinyCenter-20130614160141;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

这是appharbor连接字符串

Server=576666e4-329e-4511-95b9-a1dd00ff4766.sqlserver.sequelizer.com;Database=db576666e4329e451195b9a1dd00ff4766;User ID=yusmzpttdopksbua;Password=H3Ex6jp3wihobPu3W2KZHBpW7tDk8SWtxYWTxabXGXhVBGTAnRJZz6AgLRzKNe4L;

谁能帮帮我

最佳答案

我通过输入 appharbor 在 Web.config 上给我的 connectionString 解决了我的问题。

步骤:

1) 前往 appharbor 并选择您的应用程序。

2) 单击附加组件,然后选择 SQL Server(安装免费的)。

3) 然后单击转到 SQL Server。

4) 滚动到底部,您将看到连接字符串。

5) 复制所有(单击它并按 ctrl+A),显示 Server=bla bla bla 的部分。

6) 现在转到 Visual Studio --> Web.config 并将其粘贴到:

add name="DefaultConnection" 
connectionString="Your appharbor connectionString"
providerName="System.Data.SqlClient" />

例如,我的是这样的:

add name="DefaultConnection" 
connectionString="Data Source=(LocalDb)\v11.0;
Initial Catalog=aspnet-DeliveriandoWebApp-20131019135542;
Integrated Security=SSPI;
AttachDBFilename=|DataDirectory|\aspnet-DeliveriandoWebApp-20131019135542.mdf"
providerName="System.Data.SqlClient" />

现在是这样的:

add name="DefaultConnection" 
connectionString="Server=8a6b279b-0441-49c7-a97e-a2860049ea89.sqlserver.sequelizer.com;
Database=db8edfdf6c279c044149e7a17ea2860049ea89;
User ID=lolyctkwkaebnkj3;
Password=nYhP4hZKDNMLftEaSyeeeS8eVpbs3H3seUZQUQ8PZzMRXA5hPVfDirfPwZzHfvaFDsz;"
providerName="System.Data.SqlClient" />

关于c# - 应用程序 [Win32Exception (0x80004005) : The system cannot find the file specified] with model first EF,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17363554/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com