Меню

Error 50 произошла ошибка local database runtime невозможно создать автоматический экземпляр

To begin — there are 4 issues that could be causing the common LocalDb SqlExpress Sql Server connectivity errors SQL Network Interfaces, error: 50 - Local Database Runtime error occurred, before you begin you need to rename the v11 or v12 to (localdb)mssqllocaldb

Possible Issues
  • You don’t have the services running
  • You don’t have the firelwall ports here
    configured
  • Your install has and issue/corrupt (the steps below help give you a nice clean start)
  • You did not rename the V11 or 12 to mssqllocaldb
 \ rename the conn string from v12.0 to MSSQLLocalDB -like so-> 
 `<connectionStrings>
      <add name="ProductsContext" connectionString="Data Source= (localdb)mssqllocaldb; 
      ...`

I found that the simplest is to do the below — I have attached the pics and steps for help.

First verify which instance you have installed, you can do this by checking the registry& by running cmd

 1. `cmd> Sqllocaldb.exe i` 
 2. `cmd> Sqllocaldb.exe s "whicheverVersionYouWantFromListBefore"` 
if this step fails, you can delete with option `d` cmd> Sqllocaldb.exe d "someDb"
 3. `cmd> Sqllocaldb.exe c "createSomeNewDbIfyouWantDb"` 
 4. `cmd> Sqllocaldb.exe start "createSomeNewDbIfyouWantDb"`

SqlLOCALDb_edited.png


ADVANCED Trouble Shooting Registry configurations

Edit 1, from requests & comments: Here are the Registry path for all versions, in a generic format to track down the registry

Paths

// SQL SERVER RECENT VERSIONS
HKEY_LOCAL_MACHINESOFTWAREMicrosoftMicrosoft SQL Server(instance-name)

// OLD SQL SERVER
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesMSSQLServer
HKEY_LOCAL_MACHINESOFTWAREMicrosoftMSSQLServer
// SQL SERVER 6.0 and above.

HKEY_LOCAL_MACHINESystemCurrentControlSetServicesMSDTC
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesSQLExecutive
// SQL SERVER 7.0 and above

HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesSQLServerAgent
HKEY_LOCAL_MACHINESoftwareMicrosoftMicrosoft SQL Server 7
HKEY_LOCAL_MACHINESoftwareMicrosoftMSSQLServ65

Searching

SELECT registry_key, value_name, value_data  
FROM sys.dm_server_registry  
WHERE registry_key LIKE N'%SQLAgent%';

or Run this in SSMS Sql Management Studio, it will give a full list of all installs you have on the server

DECLARE     @SQL VARCHAR(MAX)
SET         @SQL = 'DECLARE @returnValue NVARCHAR(100)'
SELECT @SQL = @SQL + CHAR(13) + 'EXEC   master.dbo.xp_regread

 @rootkey      = N''HKEY_LOCAL_MACHINE'',
 @key          = N''SOFTWAREMicrosoftMicrosoft SQL Server' + RegPath + 'MSSQLServer'',
 @value_name   = N''DefaultData'',
 @value        = @returnValue OUTPUT; 

 UPDATE #tempInstanceNames SET DefaultDataPath = @returnValue WHERE RegPath = ''' + RegPath + '''' + CHAR(13) FROM #tempInstanceNames 

 -- now, with these results, you can search the reg for the values inside reg
 EXEC (@SQL)
 SELECT      InstanceName, RegPath, DefaultDataPath
 FROM        #tempInstanceNames

Trouble Shooting Network configurations

SELECT registry_key, value_name, value_data  
FROM sys.dm_server_registry  
WHERE registry_key LIKE N'%SuperSocketNetLib%';  

  • Remove From My Forums
  • Question

  • Step1: Opened Lightswtich

    Step2: selcted DB and Table Through wizard.

    Step 3: while Build the application getting the following error

    Error 1 An error occurred while establishing a connection to SQL Server instance ‘(LocalDB)v11.0’.
    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.
    ) C:Program Files (x86)MSBuildMicrosoftVisualStudioLightSwitchv2.0Microsoft.LightSwitch.targets 146 10 Testproj2

    Could you please recommend, what i have to solve this issue, i am very new to lightswitch.

    Thank you.

    • Edited by

      Monday, April 8, 2013 7:40 AM

Answers

  • Hi,

    LightSwitch used SQL Server 2012 Express LocalDB for tables created by LightSwitch. The error indicated that your SQL Server 2012 Express LocalDB is not working.

    First thing to check is to make sure that you have Microsoft SQL Server 2012 Express LocalDB
    installed on your machine (using Uninstall or change a program window). If not,
    this article is a good introduction to it and how to install it.

    Second thing to check is to make sure the SQL Server (SQLEXPRESS) service is running (using Services window).

    If there are issues with the service itself, either repair the instance or
    this article has good trouble-shooting steps.

    Best regards,
    Huy Nguyen

    • Proposed as answer by
      Angie Xu
      Wednesday, April 24, 2013 7:32 AM
    • Marked as answer by
      Angie Xu
      Tuesday, May 7, 2013 3:15 AM

To begin — there are 4 issues that could be causing the common LocalDb SqlExpress Sql Server connectivity errors SQL Network Interfaces, error: 50 - Local Database Runtime error occurred, before you begin you need to rename the v11 or v12 to (localdb)mssqllocaldb

Possible Issues
  • You don’t have the services running
  • You don’t have the firelwall ports here
    configured
  • Your install has and issue/corrupt (the steps below help give you a nice clean start)
  • You did not rename the V11 or 12 to mssqllocaldb
 \ rename the conn string from v12.0 to MSSQLLocalDB -like so-> 
 `<connectionStrings>
      <add name="ProductsContext" connectionString="Data Source= (localdb)mssqllocaldb; 
      ...`

I found that the simplest is to do the below — I have attached the pics and steps for help.

First verify which instance you have installed, you can do this by checking the registry& by running cmd

 1. `cmd> Sqllocaldb.exe i` 
 2. `cmd> Sqllocaldb.exe s "whicheverVersionYouWantFromListBefore"` 
if this step fails, you can delete with option `d` cmd> Sqllocaldb.exe d "someDb"
 3. `cmd> Sqllocaldb.exe c "createSomeNewDbIfyouWantDb"` 
 4. `cmd> Sqllocaldb.exe start "createSomeNewDbIfyouWantDb"`

SqlLOCALDb_edited.png


ADVANCED Trouble Shooting Registry configurations

Edit 1, from requests & comments: Here are the Registry path for all versions, in a generic format to track down the registry

Paths

// SQL SERVER RECENT VERSIONS
HKEY_LOCAL_MACHINESOFTWAREMicrosoftMicrosoft SQL Server(instance-name)

// OLD SQL SERVER
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesMSSQLServer
HKEY_LOCAL_MACHINESOFTWAREMicrosoftMSSQLServer
// SQL SERVER 6.0 and above.

HKEY_LOCAL_MACHINESystemCurrentControlSetServicesMSDTC
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesSQLExecutive
// SQL SERVER 7.0 and above

HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesSQLServerAgent
HKEY_LOCAL_MACHINESoftwareMicrosoftMicrosoft SQL Server 7
HKEY_LOCAL_MACHINESoftwareMicrosoftMSSQLServ65

Searching

SELECT registry_key, value_name, value_data  
FROM sys.dm_server_registry  
WHERE registry_key LIKE N'%SQLAgent%';

or Run this in SSMS Sql Management Studio, it will give a full list of all installs you have on the server

DECLARE     @SQL VARCHAR(MAX)
SET         @SQL = 'DECLARE @returnValue NVARCHAR(100)'
SELECT @SQL = @SQL + CHAR(13) + 'EXEC   master.dbo.xp_regread

 @rootkey      = N''HKEY_LOCAL_MACHINE'',
 @key          = N''SOFTWAREMicrosoftMicrosoft SQL Server' + RegPath + 'MSSQLServer'',
 @value_name   = N''DefaultData'',
 @value        = @returnValue OUTPUT; 

 UPDATE #tempInstanceNames SET DefaultDataPath = @returnValue WHERE RegPath = ''' + RegPath + '''' + CHAR(13) FROM #tempInstanceNames 

 -- now, with these results, you can search the reg for the values inside reg
 EXEC (@SQL)
 SELECT      InstanceName, RegPath, DefaultDataPath
 FROM        #tempInstanceNames

Trouble Shooting Network configurations

SELECT registry_key, value_name, value_data  
FROM sys.dm_server_registry  
WHERE registry_key LIKE N'%SuperSocketNetLib%';  

To begin — there are 4 issues that could be causing the common LocalDb SqlExpress Sql Server connectivity errors SQL Network Interfaces, error: 50 - Local Database Runtime error occurred, before you begin you need to rename the v11 or v12 to (localdb)mssqllocaldb

Possible Issues
  • You don’t have the services running
  • You don’t have the firelwall ports here
    configured
  • Your install has and issue/corrupt (the steps below help give you a nice clean start)
  • You did not rename the V11 or 12 to mssqllocaldb
 \ rename the conn string from v12.0 to MSSQLLocalDB -like so-> 
 `<connectionStrings>
      <add name="ProductsContext" connectionString="Data Source= (localdb)mssqllocaldb; 
      ...`

I found that the simplest is to do the below — I have attached the pics and steps for help.

First verify which instance you have installed, you can do this by checking the registry& by running cmd

 1. `cmd> Sqllocaldb.exe i` 
 2. `cmd> Sqllocaldb.exe s "whicheverVersionYouWantFromListBefore"` 
if this step fails, you can delete with option `d` cmd> Sqllocaldb.exe d "someDb"
 3. `cmd> Sqllocaldb.exe c "createSomeNewDbIfyouWantDb"` 
 4. `cmd> Sqllocaldb.exe start "createSomeNewDbIfyouWantDb"`

SqlLOCALDb_edited.png


ADVANCED Trouble Shooting Registry configurations

Edit 1, from requests & comments: Here are the Registry path for all versions, in a generic format to track down the registry

Paths

// SQL SERVER RECENT VERSIONS
HKEY_LOCAL_MACHINESOFTWAREMicrosoftMicrosoft SQL Server(instance-name)

// OLD SQL SERVER
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesMSSQLServer
HKEY_LOCAL_MACHINESOFTWAREMicrosoftMSSQLServer
// SQL SERVER 6.0 and above.

HKEY_LOCAL_MACHINESystemCurrentControlSetServicesMSDTC
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesSQLExecutive
// SQL SERVER 7.0 and above

HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesSQLServerAgent
HKEY_LOCAL_MACHINESoftwareMicrosoftMicrosoft SQL Server 7
HKEY_LOCAL_MACHINESoftwareMicrosoftMSSQLServ65

Searching

SELECT registry_key, value_name, value_data  
FROM sys.dm_server_registry  
WHERE registry_key LIKE N'%SQLAgent%';

or Run this in SSMS Sql Management Studio, it will give a full list of all installs you have on the server

DECLARE     @SQL VARCHAR(MAX)
SET         @SQL = 'DECLARE @returnValue NVARCHAR(100)'
SELECT @SQL = @SQL + CHAR(13) + 'EXEC   master.dbo.xp_regread

 @rootkey      = N''HKEY_LOCAL_MACHINE'',
 @key          = N''SOFTWAREMicrosoftMicrosoft SQL Server' + RegPath + 'MSSQLServer'',
 @value_name   = N''DefaultData'',
 @value        = @returnValue OUTPUT; 

 UPDATE #tempInstanceNames SET DefaultDataPath = @returnValue WHERE RegPath = ''' + RegPath + '''' + CHAR(13) FROM #tempInstanceNames 

 -- now, with these results, you can search the reg for the values inside reg
 EXEC (@SQL)
 SELECT      InstanceName, RegPath, DefaultDataPath
 FROM        #tempInstanceNames

Trouble Shooting Network configurations

SELECT registry_key, value_name, value_data  
FROM sys.dm_server_registry  
WHERE registry_key LIKE N'%SuperSocketNetLib%';  

  • Remove From My Forums
  • Question

  • From Robert Luongo @RobertLuongo via Twitter

    I got stuck at the point when you need to run the update-database command on the NuGet Package Console. I have followed all exact instructions, and the default connection string that has been created is as follows. <add name=»DefaultConnection»
    connectionString=»Data Source=(LocalDb)MSSQLLocalDB;AttachDbFilename=|DataDirectory|aspnet-ContactManager-20160302022257.mdf;Initial Catalog=aspnet-ContactManager-20160302022257;Integrated Security=True» providerName=»System.Data.SqlClient»
    />.

    When I run the update-database command I get the following error: 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. The specified LocalDB instance does not exist. Using NuGet Package Manager 3.3.0 with Visual Studio 2015 Community
    Version 14.0.24720.00.

    EDIT: This is now sorted !! 🙂

    Issue was as you anticipated the NuGet Package Manager was not able to create the instance specified in the DefaultConnection string. Data Source=(LocalDb)MSSQLLocalDB. I changed it to Data Source=(LocalDB)v11.0 and it now works, probably this is how the
    instance should be specified when using SQL Express Edition ??

    Thanks,
    @AzureSupport


    Thiene Schmidt

    • Edited by

      Thursday, March 3, 2016 11:33 AM

Answers

  • Yes SQL Express Edition will throw an instance specific error when using Data Source=(LocalDb)MSSQLLocalDB
    in connection string, the only way I got it to work was by changing it to 
    (LocalDB)v11.0 , so is that
    actually an SQL Express Edition issue ??? or is it caused by something else ?? thanks !!

    • Proposed as answer by
      Casey KarstMicrosoft employee
      Friday, March 4, 2016 11:52 PM
    • Marked as answer by
      Casey KarstMicrosoft employee
      Monday, March 7, 2016 3:54 PM

GENDALF_ISTARI

15 / 32 / 19

Регистрация: 20.08.2013

Сообщений: 740

1

08.02.2016, 01:14. Показов 12370. Ответов 12

Метки нет (Все метки)


Проблема подключения к серверу базы
Локально все работает
выводит данные

Publich->File публикуем проект в отдельную папку
Потом IIS ->Добавить сайт добавляем этот каталог

А как подключать SQL к IIS серверу то возникает проблема
с Сайты->Строка Подключения

Вот строка Web.Config которую подключаю в IIS

XML
1
2
3
4
<connectionStrings>
        <remove name="LocalSqlServer" />
        <add connectionString="Data Source=(LocalDB)MSSQLLocalDB;AttachDbFilename=|DataDirectory|Database_base.mdf;Integrated Security=True" providerName="System.Data.SqlClient" name="DB_Context" />
  </connectionStrings>

Строка подключения локальная обычная вот Web.Config

XML
1
2
3
4
 <connectionStrings>
    <add name="DB_Context" connectionString="Data Source=(LocalDB)MSSQLLocalDB;AttachDbFilename='|DataDirectory|Database_base.mdf';Integrated Security=True"
 providerName="System.Data.SqlClient"/>
  </connectionStrings>

Проект ссылка вот: WebApplication_base_test_manual.rar

К сожалению выводит вот (Как решить проблему товарищи)

Миниатюры

Ошибка Local Database Runtime. Невозможно создать автоматический экземпляр
 

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



Администратор

Эксперт .NET

15226 / 12265 / 4902

Регистрация: 17.03.2014

Сообщений: 24,867

Записей в блоге: 1

08.02.2016, 14:24

2

GENDALF_ISTARI, в ошибке сказано что в журнале событий была сделана запись с инфорамацией об ошибке. Найди её и выложи сюда.



1



Эксперт .NET

11043 / 7599 / 1176

Регистрация: 21.01.2016

Сообщений: 28,578

08.02.2016, 17:38

3

Не пытайтесь использовать LocalDB для работы из под IIS. Настройке нормальный сервер баз данных. Или, если вам так принципиально, то убедитесь, что у учётки из под которой работает пул веб-приложения есть права на создание экземпляра LocalDB и права на чтение файла базы данных.

Добавлено через 3 минуты
Вот вам инструкция по использованию LocalDB с IIS.



1



15 / 32 / 19

Регистрация: 20.08.2013

Сообщений: 740

08.02.2016, 18:07

 [ТС]

4

хорошо Найду шас выложу , честно не понимаю IIS он что должен иметь пароль и логин в строке в Web.Config для персонального входа не пойму где это и как видить



0



15 / 32 / 19

Регистрация: 20.08.2013

Сообщений: 740

08.02.2016, 18:39

 [ТС]

5

Вот нашел журнал называется
Диспетчер IIS-> Начальная страница(test-host.zapto.org)->IIS->Введение Журнала
(путь к логам %SystemDrive%inetpublogsLogFiles)

там папки
W3SVC1
W3SVC2
W3SVC3

я упаковал в архив LogFiles.rar их, и прикрепил к вашему серваку))
объясните как правильно базу подключить к IIS
да я сделаю на HTML инструкцию, и для себя, и вам скину))



0



Администратор

Эксперт .NET

15226 / 12265 / 4902

Регистрация: 17.03.2014

Сообщений: 24,867

Записей в блоге: 1

08.02.2016, 18:58

6

Цитата
Сообщение от GENDALF_ISTARI
Посмотреть сообщение

Вот нашел журнал называется
Диспетчер IIS-> Начальная страница(test-host.zapto.org)->IIS->Введение Журнала
(путь к логам %SystemDrive%inetpublogsLogFiles)

Это не то. Речь идет о журнале событий Windows который просматривается с помощью Event Viewer.



1



15 / 32 / 19

Регистрация: 20.08.2013

Сообщений: 740

08.02.2016, 19:30

 [ТС]

7

Администрирвание->Просмотр событий
по этой статье Windows Event

На фото события
Я их сохранил в файл log_error.evtx прикрепил к вашему серваку, в архиве log_error.rar
можно открыть Просмотр событий -> справа Импортировать кажется

Миниатюры

Ошибка Local Database Runtime. Невозможно создать автоматический экземпляр
 



0



Эксперт .NET

11043 / 7599 / 1176

Регистрация: 21.01.2016

Сообщений: 28,578

08.02.2016, 19:55

8

GENDALF_ISTARI, я же вам уже написал в чём ваша проблема. Ссылку даже предоставил, где описано решение. Вот она, на случай, если вы не увидели мой прошлый пост. Вам нужно настроить IIS на загрузку профиля пользователя, для корректной работы LocalDB.



1



GENDALF_ISTARI

15 / 32 / 19

Регистрация: 20.08.2013

Сообщений: 740

08.02.2016, 20:09

 [ТС]

9

Ех Usaga я не пойму как это делать
ведь понять можно увидив разницу между
VS2015 локальному подключению к базе в Web.config

и

Подключению в IIS в строке подключения

Я не пойму эту разницу куда строку ту пихать в той статье
в IIS ругаеться

как же ту строку пихать ?

Ну вот IIS->Строки подключения

XML
1
2
3
4
<connectionStrings>
    <add name="DB_Context" connectionString="Data Source=(LocalDB)MSSQLLocalDB;AttachDbFilename='|DataDirectory|Database_base.mdf';Integrated Security=True"
 providerName="System.Data.SqlClient"/>
  </connectionStrings>

Куда мне тулить эту строку ?

XML
1
2
3
<add name="DefaultAppPool">
        <processModel identityType="ApplicationPoolIdentity" loadUserProfile="true" setProfileEnvironment="true" />
 </add>

если я шас сделаю так пул .NET v4.5 Classic

XML
1
2
3
4
5
6
7
<connectionStrings>
    <add name="DB_Context" connectionString="Data Source=(LocalDB)MSSQLLocalDB;AttachDbFilename='|DataDirectory|Database_base.mdf';Integrated Security=True"
 providerName="System.Data.SqlClient"/>
<add name=".NET v4.5 Classic">
        <processModel identityType="ApplicationPoolIdentity" loadUserProfile="true" setProfileEnvironment="true" />
 </add>
  </connectionStrings>

то IIS->Строки подключения
скажут ошибку

и куда это тулить в той статье ?

хоть пример правильного подключения IIS есть ?



0



Эксперт .NET

11043 / 7599 / 1176

Регистрация: 21.01.2016

Сообщений: 28,578

08.02.2016, 20:23

10

Изменения нужно внести в файл C:WindowsSystem32inetsrvconfigapplicationHost.config. После этого ещё нужно будет дать пользователю, из под которого работает приложение, права на чтениезапись файла базы данных.

Добавлено через 1 минуту
В статье, что по ссылке доступна, всё это написано. Внимательнее читайте.



1



GENDALF_ISTARI

15 / 32 / 19

Регистрация: 20.08.2013

Сообщений: 740

09.02.2016, 10:10

 [ТС]

11

Нашол участок в файле %SystemRoot%inetsrvconfigapplicationHost.config

XML
1
2
3
4
5
6
7
8
9
10
11
12
13
<applicationPools>
            <add name="DefaultAppPool" />
            <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="vitaly-tornado.zapto.org" />
            <add name="test-host.zapto.org" />
            <applicationPoolDefaults managedRuntimeVersion="v4.0">
                <processModel identityType="ApplicationPoolIdentity" />
            </applicationPoolDefaults>
        </applicationPools>

добавив ( loadUserProfile=»true» setProfileEnvironment=»true»)
и мне что изменить на теге applicationPoolDefaults

XML
1
2
3
4
5
6
7
8
9
10
11
12
13
<applicationPools>
            <add name="DefaultAppPool" />
            <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="vitaly-tornado.zapto.org" />
            <add name="test-host.zapto.org" />
            <applicationPoolDefaults managedRuntimeVersion="v4.0">
                <processModel identityType="ApplicationPoolIdentity" loadUserProfile="true" setProfileEnvironment="true" />
            </applicationPoolDefaults>
        </applicationPools>

Или на теге .NET v4.5 Classic их добавить

XML
1
2
3
4
5
6
7
8
9
10
11
12
13
<applicationPools>
            <add name="DefaultAppPool" />
            <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" identityType="ApplicationPoolIdentity" loadUserProfile="true" setProfileEnvironment="true" managedRuntimeVersion="v4.0" managedPipelineMode="Classic" />
            <add name=".NET v4.5" managedRuntimeVersion="v4.0" />
            <add name="vitaly-tornado.zapto.org" />
            <add name="test-host.zapto.org" />
            <applicationPoolDefaults managedRuntimeVersion="v4.0">
                <processModel identityType="ApplicationPoolIdentity" />
            </applicationPoolDefaults>
        </applicationPools>

Еще вопрос на счет самой строки в проекте Web.Config
она правильна ?

XML
1
2
3
4
<connectionStrings>
    <add name="DB_Context" connectionString="Data Source=(LocalDB)MSSQLLocalDB;AttachDbFilename='|DataDirectory|Database_base.mdf';Integrated Security=True"
 providerName="System.Data.SqlClient"/>
  </connectionStrings>

И что менять и как ?

Добавлено через 13 часов 30 минут
Это не помогло, доступ безопасности я разрешил, для IIS каталога проекта



0



GENDALF_ISTARI

15 / 32 / 19

Регистрация: 20.08.2013

Сообщений: 740

11.02.2016, 23:11

 [ТС]

12

Ошибка Local Database Runtime IIS MVC

файле %SystemRoot%inetsrvconfigapplicationHost.config
изменение не действует

XML
1
2
3
4
5
6
7
8
9
10
11
12
13
<applicationPools>
            <add name="DefaultAppPool" />
            <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="vitaly-tornado.zapto.org" />
            <add name="test-host.zapto.org" />
            <applicationPoolDefaults managedRuntimeVersion="v4.0">
                <processModel identityType="ApplicationPoolIdentity" />
            </applicationPoolDefaults>
        </applicationPools>

Как решить проблему товарищи ?

Миниатюры

Ошибка Local Database Runtime. Невозможно создать автоматический экземпляр
 



0



15 / 32 / 19

Регистрация: 20.08.2013

Сообщений: 740

21.02.2016, 18:51

 [ТС]

13

Тема закрыта вот мой пример
инструкция решения этой проблемы
пользуйтесь )))



0



mnepoh

Описание: Необработанное исключение при выполнении текущего веб-запроса. Изучите трассировку стека для получения дополнительных сведений о данной ошибке и о вызвавшем ее фрагменте кода.

Сведения об исключении: System.Data.SqlClient.SqlException: При установлении соединения с SQL Server произошла ошибка, связанная с сетью или с определенным экземпляром. Сервер не найден или недоступен. Убедитесь, что имя экземпляра указано правильно и что на SQL Server разрешены удаленные соединения. (provider: SQL Network Interfaces, error: 50 — Произошла ошибка Local Database Runtime.Невозможно создать автоматический экземпляр. Дополнительные сведения об ошибке см. в журнале событий приложений Windows.)

Ошибка возникает даже если подключаться к полноценному SQL server.


  • Вопрос задан

    более трёх лет назад

  • 14246 просмотров

Пригласить эксперта

Так, собственно, все возможные причины уже описаны. Что вы хотите ещё узнать.
Проверьте connection string. Если стоит SQL Server, то проверьте, включен ли браузер и настроены удаленные соединения.
Но скорее всего проблема в строке подключения.

Ответ нашел только тут

Если в кратце, то помогло только изменение Application Pool Identity в LocalSystem.

Если сервер ваш и IIS в ваших руках, то проблем нет, а вот если где-то хоститесь, то на практике не могу подсказать.


  • Показать ещё
    Загружается…

28 янв. 2023, в 22:48

500 руб./за проект

28 янв. 2023, в 20:58

30000 руб./за проект

28 янв. 2023, в 20:46

50000 руб./за проект

Минуточку внимания

  • Remove From My Forums
  • Question

  • Step1: Opened Lightswtich

    Step2: selcted DB and Table Through wizard.

    Step 3: while Build the application getting the following error

    Error 1 An error occurred while establishing a connection to SQL Server instance ‘(LocalDB)v11.0’.
    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.
    ) C:Program Files (x86)MSBuildMicrosoftVisualStudioLightSwitchv2.0Microsoft.LightSwitch.targets 146 10 Testproj2

    Could you please recommend, what i have to solve this issue, i am very new to lightswitch.

    Thank you.

    • Edited by

      Monday, April 8, 2013 7:40 AM

Answers

  • Hi,

    LightSwitch used SQL Server 2012 Express LocalDB for tables created by LightSwitch. The error indicated that your SQL Server 2012 Express LocalDB is not working.

    First thing to check is to make sure that you have Microsoft SQL Server 2012 Express LocalDB
    installed on your machine (using Uninstall or change a program window). If not,
    this article is a good introduction to it and how to install it.

    Second thing to check is to make sure the SQL Server (SQLEXPRESS) service is running (using Services window).

    If there are issues with the service itself, either repair the instance or
    this article has good trouble-shooting steps.

    Best regards,
    Huy Nguyen

    • Proposed as answer by
      Angie Xu
      Wednesday, April 24, 2013 7:32 AM
    • Marked as answer by
      Angie Xu
      Tuesday, May 7, 2013 3:15 AM

  • Remove From My Forums
  • Question

  • Step1: Opened Lightswtich

    Step2: selcted DB and Table Through wizard.

    Step 3: while Build the application getting the following error

    Error 1 An error occurred while establishing a connection to SQL Server instance ‘(LocalDB)v11.0’.
    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.
    ) C:Program Files (x86)MSBuildMicrosoftVisualStudioLightSwitchv2.0Microsoft.LightSwitch.targets 146 10 Testproj2

    Could you please recommend, what i have to solve this issue, i am very new to lightswitch.

    Thank you.

    • Edited by

      Monday, April 8, 2013 7:40 AM

Answers

  • Hi,

    LightSwitch used SQL Server 2012 Express LocalDB for tables created by LightSwitch. The error indicated that your SQL Server 2012 Express LocalDB is not working.

    First thing to check is to make sure that you have Microsoft SQL Server 2012 Express LocalDB
    installed on your machine (using Uninstall or change a program window). If not,
    this article is a good introduction to it and how to install it.

    Second thing to check is to make sure the SQL Server (SQLEXPRESS) service is running (using Services window).

    If there are issues with the service itself, either repair the instance or
    this article has good trouble-shooting steps.

    Best regards,
    Huy Nguyen

    • Proposed as answer by
      Angie Xu
      Wednesday, April 24, 2013 7:32 AM
    • Marked as answer by
      Angie Xu
      Tuesday, May 7, 2013 3:15 AM

Я пытаюсь создать веб-приложение ASP.NET MVC 5 с файлом MyDatabase.mdf в папке App_Data. У меня установлен SQL Server 2014 Express с экземпляром LocalDb. Я могу редактировать таблицы базы данных с помощью Server Explorer, однако, когда я отлаживаю приложение и перехожу на страницу, где нужна база данных, я получаю следующую ошибку.

При установлении соединения с SQL Server возникла связанная с сетью или конкретная ошибка экземпляра. Сервер не найден или не был доступен. Проверьте правильность имени экземпляра и настройте SQL Server для удаленного подключения. (провайдер: Сетевые интерфейсы SQL, ошибка: 50 — Произошла ошибка локальной базы данных. Невозможно создать автоматический экземпляр. См. журнал событий приложения Windows для получения подробных сведений об ошибке.

Итак, я посмотрел в средстве просмотра событий в разделе Application и снова вижу одно предупреждение снова и снова.

Недопустимый каталог, предназначенный для кэширования сжатого содержимого. C:UsersUser1AppDataLocalTempiisexpressIIS Временные сжатые файлы Clr4IntegratedAppPool. Статическое сжатие отключается.

Поэтому я попытался перезагрузить сервер, но все равно не пошел. Такая же ошибка 50, как и раньше.

Я создал класс под Models, где у меня есть класс под названием Post.

namespace MyApplication.Models
{
    public class Post
    {
        public int Id { get; set; }
        public string Title { get; set; }
        public string Content { get; set; }
    }

    public class MyDatabase : DbContext
    {
        public DbSet<Post> Posts { get; set; }
    }
}

У меня также есть настройка Controller, чтобы перечислять сообщения из MyDatabase.

namespace MyApplication.Controllers
{
    public class PostsController : Controller
    {
        private MyDatabase db = new MyDatabase();

        // GET: Posts
        public ActionResult Index()
        {
            return View(db.Posts.ToList());
        }
    }

В моем файле web.config строка подключения выглядит так:

<connectionStrings>
    <add name="DefaultConnection" 
         connectionString="Data Source=(LocalDB)v12.0;AttachDbFilename=|DataDirectory|MyDatabase.mdf;Integrated Security=True" 
         providerName="System.Data.SqlClient" />
</connectionStrings>

Я пробовал предлагаемое предложение здесь, но это не сработало. Также попробовал этот.

Я также замечаю, что экземпляр MyDatabase отключается после запуска приложения. Если я обновляю базу данных с помощью Server Explorer в Visual Studio, я могу просмотреть таблицы.

Как я могу подключиться к базе данных и отредактировать ее в Visual Studio 2013, но когда я отлаживаю приложение, он не может подключиться к базе данных?

0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии

А вот еще интересные материалы:

  • Яшка сломя голову остановился исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного где ошибка
  • Error 220 failed at power status check status 223 ошибка lenovo
  • Error 2100 hdd0 hard disk drive initialization error 1 как исправить ошибку