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"`

ADVANCED Trouble Shooting
Registryconfigurations
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
Networkconfigurations
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 Testproj2Could 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
-
Edited by
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
-
Proposed as answer by
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"`

ADVANCED Trouble Shooting
Registryconfigurations
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
Networkconfigurations
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"`

ADVANCED Trouble Shooting
Registryconfigurations
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
Networkconfigurations
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
-
Edited by
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
-
Proposed as answer by
|
GENDALF_ISTARI 15 / 32 / 19 Регистрация: 20.08.2013 Сообщений: 740 |
||||||||
|
1 |
||||||||
|
08.02.2016, 01:14. Показов 12370. Ответов 12 Метки нет (Все метки)
Проблема подключения к серверу базы Publich->File публикуем проект в отдельную папку А как подключать SQL к IIS серверу то возникает проблема Вот строка Web.Config которую подключаю в IIS
Строка подключения локальная обычная вот Web.Config
Проект ссылка вот: WebApplication_base_test_manual.rar К сожалению выводит вот (Как решить проблему товарищи) Миниатюры
__________________
0 |
|
Администратор
15226 / 12265 / 4902 Регистрация: 17.03.2014 Сообщений: 24,867 Записей в блоге: 1 |
|
|
08.02.2016, 14:24 |
2 |
|
GENDALF_ISTARI, в ошибке сказано что в журнале событий была сделана запись с инфорамацией об ошибке. Найди её и выложи сюда.
1 |
|
11043 / 7599 / 1176 Регистрация: 21.01.2016 Сообщений: 28,578 |
|
|
08.02.2016, 17:38 |
3 |
|
Не пытайтесь использовать LocalDB для работы из под IIS. Настройке нормальный сервер баз данных. Или, если вам так принципиально, то убедитесь, что у учётки из под которой работает пул веб-приложения есть права на создание экземпляра LocalDB и права на чтение файла базы данных. Добавлено через 3 минуты
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 |
|
Вот нашел журнал называется там папки я упаковал в архив LogFiles.rar их, и прикрепил к вашему серваку))
0 |
|
Администратор
15226 / 12265 / 4902 Регистрация: 17.03.2014 Сообщений: 24,867 Записей в блоге: 1 |
|
|
08.02.2016, 18:58 |
6 |
|
Вот нашел журнал называется Это не то. Речь идет о журнале событий Windows который просматривается с помощью Event Viewer.
1 |
|
15 / 32 / 19 Регистрация: 20.08.2013 Сообщений: 740 |
|
|
08.02.2016, 19:30 [ТС] |
7 |
|
Администрирвание->Просмотр событий На фото события Миниатюры
0 |
|
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 я не пойму как это делать и Подключению в IIS в строке подключения Я не пойму эту разницу куда строку ту пихать в той статье как же ту строку пихать ? Ну вот IIS->Строки подключения
Куда мне тулить эту строку ?
если я шас сделаю так пул .NET v4.5 Classic
то IIS->Строки подключения и куда это тулить в той статье ? хоть пример правильного подключения IIS есть ?
0 |
|
11043 / 7599 / 1176 Регистрация: 21.01.2016 Сообщений: 28,578 |
|
|
08.02.2016, 20:23 |
10 |
|
Изменения нужно внести в файл Добавлено через 1 минуту
1 |
|
GENDALF_ISTARI 15 / 32 / 19 Регистрация: 20.08.2013 Сообщений: 740 |
||||||||||||||||
|
09.02.2016, 10:10 [ТС] |
11 |
|||||||||||||||
|
Нашол участок в файле %SystemRoot%inetsrvconfigapplicationHost.config
добавив ( loadUserProfile=»true» setProfileEnvironment=»true»)
Или на теге .NET v4.5 Classic их добавить
Еще вопрос на счет самой строки в проекте Web.Config
И что менять и как ? Добавлено через 13 часов 30 минут
0 |
|
GENDALF_ISTARI 15 / 32 / 19 Регистрация: 20.08.2013 Сообщений: 740 |
||||
|
11.02.2016, 23:11 [ТС] |
12 |
|||
|
Ошибка Local Database Runtime IIS MVC файле %SystemRoot%inetsrvconfigapplicationHost.config
Как решить проблему товарищи ? Миниатюры
0 |
|
15 / 32 / 19 Регистрация: 20.08.2013 Сообщений: 740 |
|
|
21.02.2016, 18:51 [ТС] |
13 |
|
Тема закрыта вот мой пример
0 |

Описание: Необработанное исключение при выполнении текущего веб-запроса. Изучите трассировку стека для получения дополнительных сведений о данной ошибке и о вызвавшем ее фрагменте кода.
Сведения об исключении: 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 Testproj2Could 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
-
Edited by
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
-
Proposed as answer by
- 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 Testproj2Could 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
-
Edited by
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
-
Proposed as answer by
Я пытаюсь создать веб-приложение 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, но когда я отлаживаю приложение, он не может подключиться к базе данных?
