当我在本地IIS下运行我的网站而不是嵌入式instead时,我在访问数据库时出现了以下错误(mdf文件位于app_data)
在建立到Server的连接时发生了与网络相关的或特定于实例的错误.找不到或无法访问服务器。验证实例名是否正确,以及Server是否配置为允许远程连接。(提供程序: SQL网络接口,错误: 26 -指定的服务器/实例定位错误)
在这里,连接字符串:
Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Sources\Local\WebApplication1\WebApplication1\App_Data\aspnet-WebApplication1-20140226022052.mdf;Integrated Security=True通过Visual和IIS Express,我可以连接到该数据库:
但问题是,我需要从另一台计算机访问已部署的应用程序,而且IIS Express不允许远程连接。这就是为什么我被迫使用本地IIS。
谢谢你的建议!
发布于 2014-03-14 01:30:40
你可能需要加倍逃离\
数据Source=(LocalDB)\v11.0;集成Security=true
发布于 2014-10-21 22:26:41
如果你在使用EntityFramework,试着把它放在App.config上,为我工作。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
发布于 2020-03-24 15:55:25
有几件事可以尝试:
Data Source=(LocalDb)\MSSQLLocalDB;Initial Catalog=aspnet-WebApplication;Integrated Security=SSPI <applicationPools>
..
<add name="MyAppPool" autoStart="true" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated">
<processModel identityType="ApplicationPoolIdentity" loadUserProfile="true" setProfileEnvironment="true" />
</add>
..
<applicationPools>或者,您可以尝试将下的身份从ApplicationPoolIdentity更改为LocalSystem.
https://stackoverflow.com/questions/22062684
复制相似问题