Last post Apr 10, 2013 07:46 AM by bhaskar.mule
Jan 03, 2013 08:28 AM|arjit.malviya|LINK
I am using NHibernate, Persistence API annd MYSql DB for my ASP.NET web application; and I have the following nhibernate mapping file:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="JPUMain" transaction-type="RESOURCE_LOCAL">
<property name="connection.connection_string">Database=DBName;Data Source=localhost;User Id=root;Password=;Charset=utf8;</property>
<property name="connection.provider" value="NHibernate.Connection.DriverConnectionProvider"/>
<property name="show_sql" value="true"/>
<property name="hbm2ddl.keywords" value="none"/>
<property name="hbm2ddl.auto" value="validate"/>
Now I am using ASP.NET login control to login. When I provide invalid credentials on the login page, then the expected behavior is that it should not redirect to any other page, and it should show a error message on the login page itself after processing the code on the server side. I have debug my code, and the server side processing seems to fine, but it website hangs after executing the server side method which verifies that whether login credentials are proper or not. And after a timeout period, it displays following 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: 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.
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:
If the application is running on either Windows 7 or Windows Server 2008R2, special configuration steps are necessary to enable automatic creation of the provider database. Additional information is available at: http://go.microsoft.com/fwlink/?LinkId=160102. If the application's App_Data directory does not already exist, the web server account must have read and write access to the application's directory. This is necessary because the web server account will automatically create the App_Data directory if it does not already exist.
If the application's App_Data directory already exists, the web server account only requires read and write access to the application's App_Data directory. This is necessary because the web server account will attempt to verify that the Sql Server Express database already exists within the application's App_Data directory. Revoking read access on the App_Data directory from the web server account will prevent the provider from correctly determining if the Sql Server Express database already exists. This will cause an error when the provider attempts to create a duplicate of an already existing database. Write access is required because the web server account's credentials are used when creating the new database.
Sql Server Express must be installed on the machine.
The process identity for the web server account must have a local user profile. See the readme document for details on how to create a local user profile for both machine and domain accounts.
My first question is, why it is trying to connect to SQL Server? I am not using SQL Server anywhere in my app!
And my second question is that it works fine when I provide valid credentials, as it verifies them and redirect to next page successfully. Also, if I provide invalid credentials, it processes the server side method to validate the credentials properly, but
after that it hangs.
Can any one please put some light on this?
Jan 03, 2013 08:51 AM|ignatandrei|LINK
I am using NHibernate, Persistence API annd MYSql DB for my ASP.NET web application
I am using ASP.NET login control to login
A network-related or instance-specific error occurred while establishing a connection to SQL Server.
And what connection string do you use in web config?
Apr 10, 2013 07:46 AM|bhaskar.mule|LINK