-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: configuring connection_string & log4net in web.config. H
PostPosted: Fri Sep 30, 2005 12:45 pm 
Beginner
Beginner

Joined: Tue Aug 23, 2005 8:15 am
Posts: 45
I develop ASP.NET application and use NHibernate.

Previously I had Web server and DB on the same machine.
After transfering Web server to another machine and switching from NHibernate beta version to current version (RC2) I became 2 serious problems. And don't what is the reason.

First PROBLEM:
-----------------
Logging doesn't work (previously it worked!!!)
Logs folder is located in ../inetpub/wwwroot/myproject/
I checked that Logs has full control rights for ASPNET user on local machine.
But logging doesn't create any file!!!!
(you can see web.config in the bottom of this messge,
it is from NHibernate.org example)

Second PROBLEM:
-----------------
I can connect to the database.
you can see that connection string in NHibernate settings looks so:
Server=machine1; Database=db1; User=sa1; Password=;

but on the aspx page I got the message:
"SQL Server does not exist or access denied"

I created the user sa1 in the SQL server and it has all rights.
And I checked that I connect to the database by that user.


I have no ideas! I killed the day :))


Anybody please help!



Web.config:
--------------

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

<configSections>
<section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections>



<nhibernate>
<add
key="hibernate.connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"
/>
<add
key="hibernate.dialect"
value="NHibernate.Dialect.MsSql2000Dialect"
/>

<add
key="hibernate.connection.driver_class"
value="NHibernate.Driver.SqlClientDriver"
/>
<add
key="hibernate.connection.connection_string"
value="Server=machine1; Database=db1; User=sa1; Password=;"
/>
<add
key="hibernate.connection.isolation"
value="ReadCommitted"
/>


</nhibernate>


<log4net>
<appender name="NHibernateFileLog" type="log4net.Appender.RollingFileAppender">
<file value="Logs/nhibernate.txt" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="100KB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%d{HH:mm:ss.fff} [%t] %-5p %c - %m%n" />
</layout>
</appender>

<appender name="GeneralLog" type="log4net.Appender.RollingFileAppender">
<file value="Logs/general.txt" />
<appendToFile value="true" />
<maximumFileSize value="100KB" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="5" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%d{HH:mm:ss.fff} [%t] %-5p %c - %m%n" />
</layout>
</appender>
<appender name="DataLog" type="log4net.Appender.RollingFileAppender">
<file value="Logs/data.txt" />
<appendToFile value="true" />
<maximumFileSize value="100KB" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="5" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%d{HH:mm:ss.fff} [%t] %-5p %c - %m%n" />
</layout>
</appender>

<!-- levels: DEBUG, INFO, WARN, ERROR, FATAL -->

<root>
<level value="DEBUG"/>
<appender-ref ref="GeneralLog" />
</root>

<logger name="NHibernate" additivity="false">
<level value="DEBUG"/>
<appender-ref ref="NHibernateFileLog"/>
</logger>
<logger name="Pushable.Data" additivity="false">
<level value="DEBUG"/>
<appender-ref ref="DataLog"/>
</logger>
</log4net>



<system.web>

<!-- DYNAMIC DEBUG COMPILATION
Set compilation debug="true" to enable ASPX debugging. Otherwise, setting this value to
false will improve runtime performance of this application.
Set compilation debug="true" to insert debugging symbols (.pdb information)
into the compiled page. Because this creates a larger file that executes
more slowly, you should set this value to true only when debugging and to
false at all other times. For more information, refer to the documentation about
debugging ASP.NET files.
-->
<compilation
defaultLanguage="c#"
debug="true"
/>

<!-- CUSTOM ERROR MESSAGES
Set customErrors mode="On" or "RemoteOnly" to enable custom error messages, "Off" to disable.
Add <error> tags for each of the errors you want to handle.

"On" Always display custom (friendly) messages.
"Off" Always display detailed ASP.NET error information.
"RemoteOnly" Display custom (friendly) messages only to users not running
on the local Web server. This setting is recommended for security purposes, so
that you do not display application detail information to remote clients.
-->
<customErrors
mode="Off"
/>

<!-- AUTHENTICATION
This section sets the authentication policies of the application. Possible modes are "Windows",
"Forms", "Passport" and "None"

"None" No authentication is performed.
"Windows" IIS performs authentication (Basic, Digest, or Integrated Windows) according to
its settings for the application. Anonymous access must be disabled in IIS.
"Forms" You provide a custom form (Web page) for users to enter their credentials, and then
you authenticate them in your application. A user credential token is stored in a cookie.
"Passport" Authentication is performed via a centralized authentication service provided
by Microsoft that offers a single logon and core profile services for member sites.
-->
<authentication mode="Windows" />

<!-- AUTHORIZATION
This section sets the authorization policies of the application. You can allow or deny access
to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous
(unauthenticated) users.
-->

<authorization>
<allow users="*" /> <!-- Allow all users -->
<!-- <allow users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
<deny users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
-->
</authorization>

<!-- APPLICATION-LEVEL TRACE LOGGING
Application-level tracing enables trace log output for every page within an application.
Set trace enabled="true" to enable application trace logging. If pageOutput="true", the
trace information will be displayed at the bottom of each page. Otherwise, you can view the
application trace log by browsing the "trace.axd" page from your web application
root.
-->
<trace
enabled="false"
requestLimit="10"
pageOutput="false"
traceMode="SortByTime"
localOnly="true"
/>

<!-- SESSION STATE SETTINGS
By default ASP.NET uses cookies to identify which requests belong to a particular session.
If cookies are not available, a session can be tracked by adding a session identifier to the URL.
To disable cookies, set sessionState cookieless="true".
-->
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="20"
/>

<!-- GLOBALIZATION
This section sets the globalization settings of the application.
-->
<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
/>

</system.web>

</configuration>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 30, 2005 1:44 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Your first problem is caused by the fact that NHibernate no longer configures logging itself, you have to do it yourself, either by calling log4net.XmlConfigurator.Configure() or using an assembly attribute, or by other means.

As for the second problem, looks like you have something misconfigured on your side.


Top
 Profile  
 
 Post subject: 2sergey
PostPosted: Fri Sep 30, 2005 2:29 pm 
Beginner
Beginner

Joined: Tue Aug 23, 2005 8:15 am
Posts: 45
Thank you very much for the first problem!!!

About the problem with "no connect to the DB at another machine".
A started profiler and din't see any attempt of connection from the machine with NHibernate. I tutned off all firewalls. And checked that I can connect with same connection string to this DB from other applications.

Could be the problem with .NET security? (I heared about such problems, when DLL not trusted by .NET can't do something).
Should I do some additional steps with NHibernate dlls or just copy them
and add references in the project?

I checked one more time all rights settings in DB, they are the same in both cases. But when the DB is remote I become the message "SQL Server does not exist or access denied" by the first attempt to execute some query to DB via NHibernate (ISession is loaded succesfully).

Best regards,
Sergey Gerasimov

sergey wrote:
Your first problem is caused by the fact that NHibernate no longer configures logging itself, you have to do it yourself, either by calling log4net.XmlConfigurator.Configure() or using an assembly attribute, or by other means.

As for the second problem, looks like you have something misconfigured on your side.


Top
 Profile  
 
 Post subject: The problem with SQL200 found, SP 4 :))
PostPosted: Mon Oct 03, 2005 5:15 am 
Beginner
Beginner

Joined: Tue Aug 23, 2005 8:15 am
Posts: 45
Thank you!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.