How to prevent SQL Server Express database file auto-creation error? - asp.net-mvc-2

When I try to run an MVC 2 app on my local IIS 7, I keep getting this error:
Failed to generate a user instance of SQL Server due to failure in
retrieving the user's local application data path. Please make sure
the user has a local user profile on the computer. The connection will
be closed.
However, I don't have anything connected to SQL Server Express, and all my connection strings work fine when I'm running on my localhost.
What is the cause of such an error? How can I prevent it?

ASP.NET applications, including MVC 2 ones, by default create a SQL Server database to store users and roles. The database is called ASPNETDB and is stored in App_Data folder - if it is not there yet, ASP.NET will try to create it when the application starts.
To create/open this database, User instance of SQL Server Express is used. To start a User Instance the user profile must be loaded for the current user (in this case whatever account the ASP.NET application pool runs as). But the default configuration for IIS application pools is not to load the user profile to limit start time time and save memory.
To enable loading user profile for an application pool go to its configuration in IIS Manager and look for Load User Profile switch in Advanced Options. Set it to true and it should work.
If you would rather avoid using User Instances and loading the user profile, you can use a different database for your application's users and roles. Just go to IIS Manager again, find your Web Site, and look for Connection Strings section in ASP.NET configuration. I bet you will see a connection string called LocalSqlServer there. Just update it to point to the database you want to use. You can see this thread to learn how to create a new ASPNETDB database. If you create it on the main SQL Server instance you will not need the profile to connect to - just create a login in SQL Server and make sure your connection string is using it.

Related

OpenLDAP CentOS7 rejects authenication sometimes

I try to setup an OpenLDAP-Server that I can use as backend for a WebSSO (LemonLDAP::NG). This specific WebSSO allows to store the sessions inside the LDAP backend.
My problem is that it seems that whenever I connect to the LDAP backend to store session data ~1 out of 10 times it works, the other times LDAP rejects the authentication.
Logs for failed attempts and for successful attempts can be found here
As you can see the maker of LemonLDAP::NG thinks the error is within OpenLDAP (or my configuration of OpenLDAP). I'm out of ideas and open to suggestions.
Looks like someone changes OpenLDAP DB during your session. Don't you have any processes with access to MDB file except this instance of OpenLDAP?
It may be slapadd/slapmodify/2nd slapd instance with the same directory value in config.
If not, could you show your slapd.conf (don't forget to change rootpw)

Entity Framework for Sql Server Compact - setting .sdf file access permissions

I am trying to write a desktop app which uses Entity Framework for sql server compact (6.0). It is using click-once deployment.
ideally, all windows users would have full access to the database file, and for this reason it is set up in:
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + #"\BlowTrial"
I am using the .net 4.0 framework, and was thinking of using the File.SetAccessControl method within the constructor for my DbConfiguration class. I have no experience with programatically setting file access permissions, and it seems like a potential minefield.
I was wondering if there might be better (or at least other) way to set access permissions to all users (and particularly if there are settings available which set the access permissions when entity framework for sql server compact creates the database file).
Thanks for your expertise.
You cannot have a shared database with Click-once, in order to set the access control list you need admin rights (ie you need to run an installer). You can also set access rights via the xcacls command line tool. Keep in mind that the SQLCE database can only be shared between users on the same machine anyway.

Entity framework application crashing on other system,

i have made an application having entity framewrok. It is wpf application, now it runs fine on my computer, but when i run this application on another system it crashes, i debugged it on other system, exception came when i try to access data of entities, what could be problem,
The underlying provider failed on Open either means that your connection string is incorrect or the application doesn't have access permission to the database (either SQL account specified in connection string or current user running the application).

Error code 40 when running SSRS reports from Internet Explorer (run as administrator)

We deployed a VB.Net application on a customer's computer that contains SSRS reports.
The application connects to the SQL Server database in the app without any problems. We installed SQL Server Data Tools so we could deploy the reports (rdl) and data source (rdl) files up to the report server. These deploy without any problems.
In SQL Server Data Tools we can "Preview" the reports without any problems as well.
We do run into a problem when attempting to view the report from Internet Explorer (run as an administrator).
We get the following error:
Cannot create a connection to data source 'DataSourceReports'
(this is the name we used for the TargetDataSourceFolder)
error:40 - Could not open a connection to SQL Server
We also get the same error when the app we deployed runs the reports.
Please let us know what is not set up correctly on the SQL Server side.
A likely possibility is that you are experiencing a double hop authentication problem. It's not clear from your explanation, but is the SQL Server database on a separate server from the report server? If so, then your credentials allow you to connect to the report server but Windows integrated security does not pass those credentials on to the SQL Server database if you are using NTLM on the report server. The report server tries to use Kerberos on your network to authenticate by way of ticketing to the SQL Server database, but you must have this configured correctly on your network. See this article if you want to use Kerberos: http://technet.microsoft.com/en-us/library/ff679930(v=sql.100).aspx.
Another (easier) solution is to open the data source on the report server and change the authentication to use stored credentials. Make sure the credentials you use have read permission on the SQL Server database. The downside of this approach is that you cannot use row-level security in your report by user unless you design your report to capture user information and set up the query or a filter on the dataset to restrict data by user. If that's not a concern, the stored credentials are easy to set up and maintain - and you're going to have to do this anyway if you want to use caching, snapshots, or subscriptions. For more information on stored credentials, see http://msdn.microsoft.com/en-us/library/ms159736.aspx.

By default, where is the membership data saved in Asp.Net MVC 2?

I create MVC application, run it and register.
I cannot find the location the membership data saved.
Where is it?
Note: The application run on developer web server (cassini).
The default MVC application will store user credentials in aspnetdb.mdf which will reside in your App_Data directory. When you run the application the file will be created and attached to SQL Server Express if it doesn't already exist.
Open your web.config file and check out the "ApplicationServices" connection string to see the default values.