Answered by:
The system cannot find the file specified during webhosting

Question
-
User13364659 posted
I am using asp.net identity with EF data first approach. I have hosted my website on appharbor. All of my controllers actions and webapi is working fine except
AccountController
. When a user tries to signup it gives theInternal server error
. The details of error is:[Win32Exception (0x80004005): The system cannot find the file specified] [SqlException (0x80131904): 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: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.)]
My
AccountController
is:[Authorize] public class AccountController : Controller { private Entities db = new Entities(); public AccountController() : this(new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext()))) { } [HttpPost] [AllowAnonymous] public async Task<JsonResult> RegisterUser(string email, string password = "aa") { var roleManager = new RoleManager<Microsoft.AspNet.Identity.EntityFramework.IdentityRole>(new RoleStore<IdentityRole>(new ApplicationDbContext())); if (!roleManager.RoleExists("Admin")) { var role = new Microsoft.AspNet.Identity.EntityFramework.IdentityRole(); role.Name = "Admin"; roleManager.Create(role); } var ab = email.Split('@'); var user = new ApplicationUser() { UserName = email }; user.Email = ab[0]; UserManager.PasswordValidator = new PasswordValidator { RequiredLength = -1 }; var result = await UserManager.CreateAsync(user, password); if (result.Succeeded) { var currentUser = UserManager.FindByName(user.UserName); var roleresult = UserManager.AddToRole(currentUser.Id, "Admin"); try { await SignInAsync(user, isPersistent: true); } catch (Exception e) { string s = e.ToString(); } var id = user.Id; var data =await db.AspNetUsers.FindAsync(id); if (password == "aa") { data.IsPasswordSaved = false; } else { data.IsPasswordSaved = true; } db.Entry(data).State = System.Data.Entity.EntityState.Modified; await db.SaveChangesAsync(); return Json("Done", JsonRequestBehavior.AllowGet); } return Json("Error", JsonRequestBehavior.AllowGet); } }
I have tried to enable remote connections from this answer. But in
SQL Server Configuration Manager
theSQL Server Network Configuration
does not has the optionProtocols for SQLEXPRESS
. How can I tackle this issue?Saturday, February 20, 2016 7:59 AM
Answers
-
User-219423983 posted
Hi Irfanyusanif,
You could first refer to the following blog to enable the remote connection of the SQL Server.
Besides, you could have a look at the following similar thread which provides some steps to handle this error.
http://stackoverflow.com/questions/20463119/the-system-cannot-find-the-file-specified
Best Regards,
Weibo Zhang
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, February 22, 2016 8:31 AM
All replies
-
User-1315512054 posted
Hello,
You could check if you can connect to the SQL server by typing in command prompt "telnet sqlserver 1433". If you cannot, make sure that the SQL server is configured for remote connections and your firewall/antivirus software do not block the 1433 port connections.
Regards
Saturday, February 20, 2016 8:08 AM -
User13364659 posted
it says 'telnet' is not recognized as an internal or external command. To configure remote connections I followed instructions from http://stackoverflow.com/a/11278115/3952692 . But in
SQL Server Configuration Manager
the `SQL Server Network Configuration`
does not has the option `Protocols for SQLEXPRESS`
Saturday, February 20, 2016 9:16 AM -
User-219423983 posted
Hi Irfanyusanif,
You could first refer to the following blog to enable the remote connection of the SQL Server.
Besides, you could have a look at the following similar thread which provides some steps to handle this error.
http://stackoverflow.com/questions/20463119/the-system-cannot-find-the-file-specified
Best Regards,
Weibo Zhang
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, February 22, 2016 8:31 AM