I use MVC 4 with My Custom Membership controller can test normally in my Localhost but when upload to Server it show when go to page that need authorize
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)
I don't use any ms sql in this project so this error is wild. After check on my code that use sql connection name "DefaultConnection" I found in 2 place
AccountModels.cs in Models
InitializeSimpleMembershipAttribute.cs in Filters
so I don't use InitializeSimpleMembershipAttribute in any place so I chnage
AccountModels.cs in line 14,15
public UsersContext()
: base( "DefaultConnection" )
to
public UsersContext()
: base( "MyDBConnection" )
and now it work fine.
Hope this help.
ไม่มีความคิดเห็น:
แสดงความคิดเห็น