Gần đây, tôi đã triển khai trang web của mình trên IIS (LocalDB). Nhưng bất cứ khi nào tôi cố gắng để chạy các trang web, SQL không kết nối. Tôi đã trải qua hàng trăm bài viết/bài viết ngay bây giờ nhưng tôi không thể giải quyết nó.SQL sẽ không kết nối sau khi triển khai
Lỗi
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.)
kiện Windows Application log
Windows API call SHGetKnownFolderPath returned error code: 5. Windows system error message is: Access is denied. Reported at line: 422.
Second log -
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.
kết nối của tôi Strings (đã thử cả hai) -
<appSettings>
<add key="ConnectionString" value="Data Source=(LocalDB)\MSSQLLocalDB;Initial Catalog=test;Integrated Security=True" />
<!--<add key="ConnectionString" value="data source=(LocalDB)\MSSQLLocalDB;UID=SOME_USERNAME;PWD=SOME_PASSWORD;initial catalog=test;connection timeout=30"/>-->
</appSettings>
Tôi đã thử chỉnh sửa applicationHost.config.
Load User Profile là đã True cho tôi nộp
My applicationHost.config
<applicationPools>
<add name="Classic .NET AppPool" managedRuntimeVersion="v2.0" managedPipelineMode="Classic" />
<add name=".NET v2.0 Classic" managedRuntimeVersion="v2.0" managedPipelineMode="Classic" />
<add name=".NET v2.0" managedRuntimeVersion="v2.0" />
<add name=".NET v4.5 Classic" managedRuntimeVersion="v4.0" managedPipelineMode="Classic" />
<add name=".NET v4.5" managedRuntimeVersion="v4.0" />
<add name="ASP.NET v4.0" managedRuntimeVersion="v4.0">
<add name="DefaultAppPool" autoStart="true" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated">
<processModel identityType="ApplicationPoolIdentity" loadUserProfile="true" setProfileEnvironment="true" />
</add>
</applicationPools>
DefaultApplicationPool -
EDIT -
Added IIS AppPool sử dụng
icacls c:\inetpub\wwwroot /grant "IIS APPPOOL\DefaultAppPool":(OI)(CI)(RX)
Vẫn không thể kết nối.
Mọi trợ giúp đều được đánh giá cao.
Tôi đang sử dụng Visual Studio 2015 với SQL Server 2016.
Bạn có cho phép tải Hồ sơ người dùng cho tài khoản chạy các hồ bơi ứng dụng? – Tim
@Tim Tải Hồ sơ Người dùng đã đúng đối với tôi. –
Có, nhưng khi bạn nói điều đó là đúng cho bạn, bạn có nghĩa là tài khoản của bạn, hoặc cho tài khoản chạy các ứng dụng hồ bơi của ứng dụng? – Tim