2017-12-21 18 views
1

내 홈 네트워크에있는 다른 컴퓨터에 내 웹 사이트를 게시하려고합니다. 나는 그 컴퓨터에 IIS와 SQL Server 2016 Express를 설치했다. 내 개발 랩톱에서 같은 버전. 사이트를 실행할 때 아래 오류가 발생합니다. 문제는 내가 LocalDB에 우리에게 노력하고 있다고 생각합니다. 나는 종종 여행 중이며 인터넷에 연결되어 있지 않은 지역에 있습니다. 이것이 내가 개발하는 동안 localDB를 사용하는 것이 가장 좋을 것이라고 생각한 이유입니다. 일단 집에 도착하면 나는 내 서버에 게시합니다.게시 ASP.net 웹 사이트 LocalDB

원래 LocalDB는 내 컴퓨터에서 내 프로젝트에서 멀리 떨어진 폴더에 만들어졌습니다. 그래서 내가 한 것은 app_data로 이동하여 게시 할 때 app_data를 첨부하는 것입니다.

내가 시도하는 것 :

  1. 데이터베이스 서버에 App_Data 폴더에 실제로 데이터베이스를 찾는
  2. 변경된 연결 문자열이었다 보장 서버 2016 (확인 LocalDB가 설치된 제)를 다시 설치 마이크로 소프트 SQL in app_data

어떤 제안이 좋을 것입니다.

연결 문자열 :

<connectionStrings 
    <add name="IgorsSellersToolBoxDB" 
     connectionString="metadata=res://*/Models.ModelDB.csdl|res://*/Models.ModelDB.ssdl|res://*/Models.ModelDB.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source= LocalDB)\MSSQLLocalDB;attachdbfilename=|DataDirectory|\IgorsSellersToolBoxDB.mdf;integrated security=True;multipleactiveresultsets=True;connect timeout=30;application name=EntityFramework&quot;" 
     providerName="System.Data.EntityClient" /> 
</connectionStrings> 

오류 :

Server error in '/WebToolbox' Application.

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. )

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.

Exception Details: System.Data.SqlClient.SqlException: 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.)

Source error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.`

+0

스택 추적에 따르면 충분한 권한이 없거나 SQL Server가 P에서 실행되고 있지 않은 것 같습니다 기음. 당신은 명시 적으로 그것을 시도 할 수 있습니다, 서비스 -> SQL 서버 -> 시작 또는 재시작을 마우스 오른쪽 버튼으로 클릭하십시오. –

+0

프로덕션 환경에서 localdb를 사용하지 마십시오. 모든 데이터를 SQL 서버로 옮긴 다음 거기에서 수행하십시오. 또한 SQL 서버 관리 스튜디오 – Steve

+0

@steve에서 SQL Server의 연결 문자열을 찾으십시오. 왜 localdb를 사용하면 프로덕션에 적합하지 않습니까? 모든 데이터를 SQL Server로 이동하는 경우 인터넷이없는 위치의 프로젝트에서 어떻게 작업 할 수 있습니까? 나는 보통 연결이없는 지역의 프로젝트에서 일하고 일단 인터넷을 통해 위치를 얻으면 사이트를 게시합니다. 이것이 localdb가 나에게 너무 매력적이었던 이유입니다. – Igorski88

답변

0

스티브 코멘트에서 언급 한 바와 같이, 내가 생산에 localDB를 사용하는 것은 눈살을 찌푸리게되는 것을 확인했다.

솔루션 : 내 개발 컴퓨터에서는 SQL Server를 사용하고 프로덕션 서버에서는 별도의 SQL Server를 사용하십시오. 내 Web.Config에서 별도의 연결 문자열을 사용해야 만합니다.

  • Web.Release.Config
  • 에게