Click here to Skip to main content
15,879,095 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The website runs perfectly fine on my local computer. but when i upload it to the server.

and run the login or register button it says this

System.ComponentModel.Win32Exception: Access is denied
1. A network-related or instance-specific error occurred while establishing a connection to SQL Server.

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

3.error: 56 - Unable to load the SQLUserInstance.dll from the location specified in the registry. Verify that the Local Database Runtime feature of SQL Server Express is properly installed



could this be because the filter file in my local computer is this

<pre lang="c#"> [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method,  AllowMultiple = false, Inherited = true)]
    public sealed class InitializeSimpleMembershipAttribute : ActionFilterAttribute
    {
        private static SimpleMembershipInitializer _initializer;
        private static object _initializerLock = new object();
        private static bool _isInitialized;

        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            // Ensure ASP.NET Simple Membership is initialized only once per app start
            LazyInitializer.EnsureInitialized(ref _initializer, ref _isInitialized, ref _initializerLock);
        }

        private class SimpleMembershipInitializer
        {
            public SimpleMembershipInitializer()
            {
                Database.SetInitializer<UsersContext>(null);

                try
                {
                    using (var context = new UsersContext())
                    {
                        if (!context.Database.Exists())
                        {
                            // Create the SimpleMembership database without Entity    Framework migration schema
                            ((IObjectContextAdapter)context).ObjectContext.CreateDatabase();
                        }
                    }

                    WebSecurity.InitializeDatabaseConnection("DefaultConnection",  "UserProfile", "UserId", "UserName", autoCreateTables: true);
                }
                catch (Exception ex)
                {
                    throw new InvalidOperationException("The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588", ex);
                }
            }
        }

.





COULD THIS BE BECAUSE THE WEBSECURITY.INITIALISE DATABASECONNECTION CONTAINS THE DEFAULT CONNECTION OF MY LOCAL COMPUTER AND NOT OF THE SERVERS..IF SO CAN SOMEONE TELL ME HOW TO CHANGE IT

What I have tried:

I HAVE TRIED ADDING

under web.config
<system.web>
<customerrors mode="Off" />
</system.web>


for allowing remote connection

what should i do server side for the problem to be removed
Posted
Updated 20-Apr-16 22:55pm
v2

1 solution

With the connection string you're using the web server can't access the SQL Server. If the connection string is pointing to "localhost" then the SQL Server and database needs to be on the web server too. Consult the documentation from your webhost about where your SQL Server is and what connection string you should be using to it.

If you need different connection strings on local and published server then use web.config transformations (google for examples) to ensure the right string is used when the site is published.
 
Share this answer
 
v2
Comments
Himaan Singh 21-Apr-16 5:24am    
my server host is dev do you have any idea of the default connection string that they provide ?
F-ES Sitecore 21-Apr-16 5:28am    
There is no "default", your connection string has to be correct for the database you are targeting.

https://www.connectionstrings.com/sql-server/
Himaan Singh 21-Apr-16 5:55am    
ok i have changed the connection string as you have told. but it is showing an exception

System.Reflection.TargetInvocationException

{"The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900