I've created a user from the ASP.NET Configuration
I'm using sql server but I haven't created any database for membership.
I did add this to the config file:
<authentication mode="Forms">
<forms loginUrl="Login.aspx"></forms>
</authentication>
<authorization>
<allow users="admin" />
<deny users="?" />
</authorization>
where admin is the user I did creat.
and it works very well localy.
after I have uploded my website I got an error that I have to create an App_Data folder with write permission and add it to my application folder, now I get this :
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)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
The above error message that you are getting will only occur on a remote call. It may work locally fine. This is due to the fact that the remote connections are not enabled on the SQL Server surface Area configuration. To accomplish this, please follow below steps:
Make sure your database engine is configured to accept remote connections:
• Start > All Programs > SQL Server 2005 > Configuration Tools > SQL Server Surface Area Configuration
• Click on Surface Area Configuration for Services and Connections
• Select the instance that is having a problem > Database Engine > Remote Connections
• Enable local and remote connections
• Restart instance
Alternatively, if you are using a named SQL Server instance, make sure you are using that instance name in your connection strings in your ASweb P.NET application
• Usually the format needed to specify the database server is machinename\instancename
• Check your connection string as well
**
**
Related
The registration works fine, user is created, and the role the new user chooses is applied fine. On some controllers I restrict access with [Authorize] and this works good with the user being redirected to the login. The problem arises when I want to authorize by roles. When I change
[Authorize]
to
[Authorize(Roles = "Sales")]
the app hangs before the browser reports the error:
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)
SQLExpress database file auto-creation error:
The connection string specifies a local Sql Server Express instance using a database location within the application's App_Data directory. The provider attempted to automatically create the application services database because the provider determined that the database does not exist. The following configuration requirements are necessary to successfully check for existence of the application services database and automatically create the application services database:
This only happens when I add the role condition. The Default connection in the Web.Config points to the SQL Server database I am using. For some reason, the condition of allowing only certain roles makes it want to start creating a database with SQLExpress
Why is this happening and how do I stop it?
I have teamlab running very well on a godaddy virtual dedicated server and I am now moving to Azure VM server, I copied all teamlab files to this new server and ran the teamlab service, but when I open the website I get this error:
Security Exception
Description: The application attempted to perform an operation not
allowed by the security policy. To grant this application the
required permission please contact your system administrator or change
the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Invalid username
or password.
I compared all IIS config on both servers and they are both the same now, what should I check else to run this?
Note old server IIS7.5 new server IIS8
I am trying to set up a new azure website. I have done this before and everything just worked, this time I'm having real trouble getting the database set up.
I setup both site and database in the deploy wizard, and have a connection string named the same as on my local box. The error I'm getting is below:
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)
If i copy paste the connection string from azure to my local box (and add my local ip to the whitelist for SqlAzure) then it works fine locally (which is why I'm a little stumped)
The only thing that that I have noticed is that if I download the web.config for the site as configured in azure there are no connection strings. I imagine that this is because they are doing some clever security thing.
Any idea what I can even try next to diagnose this?
I spent hours on this with no success. Any help appriciated:
I create LocalDB instance
sqllocaldb create test
i start that instance
sqllocaldb start test
i share that instance with same user account that owns the original instance
sqllocaldb share "domain\user" test testShared
Both instances are in "running" state.
I launch MS SQL Management studio and try to connect to instances. Results:
I'm able to connect to both instances using named pipes - OK.
I'm able to connect to (localdb)\test - OK.
I'm not able to connect to (localdb)\.\testShared - NOT OK.
Error message:
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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 2)
Any ideas? I tried that on 4 different computers. It works correctly on two of them. 3 of coputers are connected to domain (so it has probably nothing to do with domain environment).
In SQL Configuration Manager - all protocols are enabled.
What I need to achieve - share the LocalDB instance with IIS APPPOOL\ASP.NET v4.0 account according to this.
Based on the exact steps, as you described them, all you need to do is to restart your instance. It is required after you share it, so that it listens on the public pipe with the well known name that was assigned to it by the sharing process.
you need to enable setProfileEnvironment. This requires editing
applicationHost.config file which is usually located in
C:\Windows\System32\inetsrv\config. Following the instructions from KB
2547655 we should enable both flags for Application Pool ASP.NET v4.0,
like this:
http://blogs.msdn.com/b/sqlexpress/archive/2011/12/09/using-localdb-with-full-iis-part-1-user-profile.aspx
<applicationPools>
<add name="DefaultAppPool">
<processModel identityType="ApplicationPoolIdentity" loadUserProfile="true" setProfileEnvironment="true" />
</add>
<add name="ASP.NET v4.0" autoStart="true" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated">
<processModel identityType="ApplicationPoolIdentity" loadUserProfile="true" setProfileEnvironment="true" />
</add>
I have a C# / Entity Framework web application runs fine against a local SQL 2012 db. I copied the db out to a new RDS instance, and can access the db via Visual Studio and SQL Server Management Studio.
I hav a unit test which authenticates the user and then attempts inserts a record in a table using an Entity Framework call -- dataContext.SaveChanges().
I get the following error:
{"The underlying provider failed on Open."}
{"No such host is known"}
{"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: TCP Provider, error: 0 - No such host is known.)"}
I've poked around the web for answer all day, and so far no success with any of the suggestions I found:
Port 1433 is open I can access the entry point via Telnet
My IP address is covered by the CIDR/IP range for the default security
group.
The error occurs as soon as I attempt to open the connection
on the datacontext.
The db server is configured to accept remote
connections.
The db server is configured to use mixed authentication
(both Windows and SQL Server).
Entity Framework Connection String
connectionString = "metadata=res://*/MyDb.csdl|res://*/MyDb.ssdl|res://*/MyDb.msl;provider=System.Data.SqlClient;provider connection string="Data Source=MyAwsEntryPoint;Initial Catalog=MyDb;User ID=MyUser;Password=MyPassword;Persist Security Info=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient"
Standard Db Connection String
connectionString = "Data Source=MyAwsEntryPoint,1433;Initial Catalog=MyDb;User ID=MyUser;Password=MyPassword;Persist Security Info=True;Application Name=MyAppName;"
The problem was in the connection string. Specifically, I had "Application Name" and "App" properties in there. Once I removed those, it worked.
BAD:
<add name="MyDbEntities" connectionString="metadata=res://*/MyDb.csdl|res://*/MyDb.ssdl|res://*/MyDb.msl;provider=System.Data.SqlClient;provider connection string="Data Source=MyDbServer;Initial Catalog=MyDb;Persist Security Info=True;User ID=MyDb;Password=MyPassword;Application Name=MyDb.API.Models;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
GOOD:
<add name="MyDbEntities" connectionString="metadata=res://*/MyDb.csdl|res://*/MyDb.ssdl|res://*/MyDb.msl;provider=System.Data.SqlClient;provider connection string="Data Source=MyDbServer;Initial Catalog=MyDb;Persist Security Info=True;User ID=MyDb;Password=MyPassword;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />