Cách sửa lỗi khi lập trình bằng Visual Studio Lightswitch 2011


Trong quá trình lập trình và debug Build Project chúng ta rất thường hay gặp các lỗi sau:

1. If a user has installed SharePoint 2010 on a Windows 7 machine the default SQLExpress Instance is “SharePoint” which doesn’t connect to the default instance of SQLExpress needed by LightSwitch
—————————————-
An error occurred while establishing a connection to SQL Server instance ‘.\.\SharePoint’.
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.

2. Cannot connect to PC-NAME\SQLEXPRESS. 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: 26 – Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=-1&LinkId=20476

3. I cannot run any LightSwitch program

I downloaded and installed LigthSwitch hopping to start beta testing immediately. Unfortunatelly, it cannot access the SQLExpress database instance, and I could not figure-out what is wrong.

Các bước sửa lỗi như sau:

Bước 1.

Changing the option in Options ==> Database Tools==>Data Connections will apply to the new projects that you create.

Try looking for the .lsproj file for you project on the file system. If you open this file in notepad, you’ll see a SQLEPXRESSINSTANCENAME element which will be set to SQLEXPRESS. Correcting this setting may fix your problem.

Bước 2.

Deleting all files in the dir ‘%LOCALAPPDATA%\Microsoft\Microsoft SQL Server Data\SQLEXPRESS’ solved the problem.

Bước 3.

Please check the ServerName which you provided. It should match with the below shown Name in the UserName textbox, and that name should followed with \SQLEXPRESS:

Connect dialog

Bước 4.

I know this question is old, but in case it helps anyone make sure the SQL Server Browser is running in the Services MSC. I installed SQL Server Express 2008 R2 and the SQL Server Browser Service was set to Disabled.

  1. Start->Run->Services.msc
  2. Find “SQL Server Browser”->Right Click->Properties
  3. Set Startup Type to Automatic->Click Apply
  4. Retry your connection.

About thangletoan

Hallo Aloha

Posted on 05/08/2012, in Công nghệ và Giáo dục, Chính sách CNTT, LOB, LOB - Lập trình - Phát triển phần mềm, Microsoft, Programming, SQL server, Training Online and tagged . Bookmark the permalink. Để lại bình luận.

Gửi phản hồi

Mời bạn điền thông tin vào ô dưới đây hoặc kích vào một biểu tượng để đăng nhập:

WordPress.com Logo

Bạn đang bình luận bằng tài khoản WordPress.com Log Out / Thay đổi )

Twitter picture

Bạn đang bình luận bằng tài khoản Twitter Log Out / Thay đổi )

Facebook photo

Bạn đang bình luận bằng tài khoản Facebook Log Out / Thay đổi )

Google+ photo

Bạn đang bình luận bằng tài khoản Google+ Log Out / Thay đổi )

Connecting to %s

%d bloggers like this: