Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

asp.net mvc - Connection string between IIS and SQL server

I'm confused by the connection string in the Web.config file of project with Entity Framework Web API. There are a lot of variants I tried, but none of them was helping me out. Currently the connection string is

  <connectionStrings>
       <add name="DefaultConnection" connectionString="Server=.SQLEXPRESS;Database=MyProject;User Id=John;Password=duck;" providerName="System.Data.SqlClient" />
  </connectionStrings>

I can access the database which is called MyProject in SQL Server Management Studio 2012 (even from remote), using John as username and duck as password.

The project is run by an IIS server on the same machine as the SQL server, the SQL server's instance name is SQLEXPRESS. My webpage is displayed on localhost, but the controller just replies 500 Interal server error whenever some data from the sql database is requested. It looks like there is no connection to the database.

What do I have to add or change in order to get a connection betweeen IIS and SQL server, or how can I locate better the problem's cause?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Use the Event Viewer to get more information on what the 500 error actually is.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...