Ok I inherited this app so I don't know alot about it. I do know it runs just fine on the production server, same code. However I just set up the development environment and running the app in random places I get the error:
Failed to lazily initialize a collection - no session
I get it in more than one place, and like I said the application runs on another server perfectly so my question is do I need to do something special to set up the environment. If it's a simple db query it works fine. So not every db pull is failing.
here is the web.config:
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<configSections>
<section name="HostMap" type="System.Configuration.DictionarySectionHandler"/>
<sectionGroup name="blowery.web">
<section name="httpCompress" type="blowery.Web.HttpCompress.SectionHandler, blowery.Web.HttpCompress"/>
</sectionGroup>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
<section name="DistRewrite" type="System.Configuration.DictionarySectionHandler"/>
<section name="activerecord"
type="Castle.ActiveRecord.Framework.Config.ActiveRecordSectionHandler, Castle.ActiveRecord" />
</configSections>
<activerecord>
<config>
<add
key="hibernate.connection.driver_class"
value="NHibernate.Driver.SqlClientDriver" />
<add
key="hibernate.dialect"
value="NHibernate.Dialect.MsSql2000Dialect" />
<add
key="hibernate.connection.provider"
value="NHibernate.Connection.DriverConnectionProvider" />
<add
key="hibernate.connection.connection_string"
value="Server=localhost;Database=prod;Trusted_Connection=True;Async=True;" />
</config>
</activerecord>
<appSettings>
<add key="AuthNetServer" value="https://secure.authorize.net/gateway/transact.dll"/>
<add key="MD5Salt" value="}4gkG44b"/>
<add key="AuthNetLogin" value=""/>
<add key="TransactionKey" value="n7SRrNpOGjTf7Sjy"/>
<add key="AuthNetTest" value="true"/>
<add key="AppKey" value="FOdJ9+c93t02EiKS7AyQA7q5uBid12DRdbEuP4x1vt7djA0I0yMSzwkOLtLFpOOHj0hk7BtWIWCos5Gxlx4q0Uq9Dy1ZJUEY3v98Pyf72QIKfsRj5Se8OrQQfcyo/N1euNCIVSuDzOAVJVopqO/UHrTKm/RC0E/huza1TiDPinI="/>
<add key="AppIV" value="ARqpOyQtn6URrCN54F7ni5dkTQRxWwY+Itkvk5YuD9rLx4tQfj3K3kQpdTcyCLWGND7dOlXOYmee54GOKhWBo9l3069uDKQv+b9Ldd1uVnBq79nU3JTH8VfdhlIFU8PfRmQSNPHN3odqi4MR5o39jqEQsBTlQMWlLg8WrmjxzkA="/>
<add key="ReportServer" value="http://localhost/ReportServer" />
<add key="ReportViewerUrl" value="https://localhost/Report.aspx" />
<add key="ReportSvcUrl" value="http://localhost/ReportServer/ReportService.asmx"></add>
<add key="ReportFolder" value="Production"></add>
<add key="warningTimeout" value="360000"/>
<add key="TrostEmail" value=""/>
<add key="ProspectEmail" value=""/>
<add key="UseProxy" value="false"/>
<add key="RequireSSL" value="false"/>
<add key="CacheEnabled" value="false"/>
<add key="TrostSetup" value=""/>
<add key="TrostArchive" value=""/>
<add key="TrostUrgent" value=""/>
<add key="SatTracksErrorCC" value=""/>
<add key="UseCVV" value="false"/>
<add key="UseSSL" value="false"/>
<add key="ReportService.ReportService" value="http://localhost/ReportsService/ReportServer/ReportService.asmx"/>
<add key="ReportUser" value="reportuser"/>
<add key="ReportPassword" value="R3port5"/>
<add key="OEUrl" value="/OE/"/>
<!--Mail settings-->
<add key="SmtpHost" value="127.0.0.1"/>
<add key="SmtpPort" value="25"/>
<add key="RetailerServiceEmail" value="fcortez@thebhwgroup.com"/>
<add key="LibraryMail" value="mestrada@thebhwgroup.com"/>
<add key="MailTemplatePricing" value="pricing.txt"/>
<add key="UpdateMail" value="mestrada@thebhwgroup.com"/>
<add key="MailTemplateProfileUpdate" value="profile.txt"/>
<add key="MailTemplateWelcome" value="welcome.txt"/>
<add key="MailTemplateSpanishUpdate" value="spanishupgrade.txt"/>
<add key="SatTracksPromotionName" value="DHA-18 Q2 2006"/>
<add key="CacheFolder" value="c:\projects\cache"/>
</appSettings>
<connectionStrings>
<add name="efront" connectionString="Server=localhost;Database=prod;Trusted_Connection=True;Async=True;"
providerName="System.Data.SqlClient" />
<add name="xioe" connectionString="Server=localhost;Database=prod;Trusted_Connection=True;Async=True;"
providerName="System.Data.SqlClient" />
<add name="center" connectionString="Server=localhost;Database=prod;Trusted_Connection=True;Async=True;"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.net>
<mailSettings>
<smtp from="">
<network host="localhost"></network>
</smtp>
</mailSettings>
</system.net>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
Visual Basic options:
Set strict="true" to disallow all data type conversions
where data loss can occur.
Set explicit="true" to force declaration of all variables.
-->
<compilation debug="true" strict="false" explicit="true">
<assemblies>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="AjaxControlToolkit, Version=1.0.10201.0, Culture=neutral, PublicKeyToken=28F01B0E84B6D53E" />
<add assembly="System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
</assemblies>
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</buildProviders>
</compilation>
<pages theme="default">
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.Collections"/>
<add namespace="System.Collections.Specialized"/>
<add namespace="System.Configuration"/>
<add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Web"/>
<add namespace="System.Web.Caching"/>
<add namespace="System.Web.SessionState"/>
<add namespace="System.Web.Security"/>
<add namespace="System.Web.Profile"/>
<add namespace="System.Web.UI"/>
<add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.WebParts"/>
<add namespace="System.Web.UI.HtmlControls"/>
</namespaces>
</pages>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<roleManager enabled="true">
<providers>
<remove name="AspNetSqlRoleProvider"/>
<add connectionStringName="xioe" applicationName="storefront" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</providers>
</roleManager>
<membership defaultProvider="SqlProvider">
<providers>
<clear/>
<add connectionStringName="xioe" applicationName="storefront" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Hashed" name="SqlProvider" minRequiredPasswordLength="4" minRequiredNonalphanumericCharacters="0" type="System.Web.Security.SqlMembershipProvider"/>
</providers>
</membership>
<profile defaultProvider="MyProfileProvider">
<providers>
<add name="MyProfileProvider" connectionStringName="callcenter" applicationName="/" type="BHW.Web.Profile.ProfileProvider, App_code"/>
</providers>
<properties>
<add name="FirstName" type="string" serializeAs="String"/>
<add name="LastName" type="string" serializeAs="String"/>
<add name="Email" type="string" serializeAs="String"/>
<add name="AgentType" type="Int32" serializeAs="String"/>
<add name="Location" type="Int32" serializeAs="String"/>
<add name="RetailUserId" type="System.Guid" serializeAs="String"/>
<add name="CallPool" type="Int32" serializeAs="String" defaultValue="1"/>
<add name="TimeZone" type="Int32" serializeAs="String" defaultValue="20"/>
</properties>
</profile>
<httpModules>
<add name="CompressionModule" type="blowery.Web.HttpCompress.HttpModule, blowery.web.HttpCompress"/>
<add name="Page" type="BHW.XIOE.HostMap, BHW.XIOE.HostMap"/>
<add name="DistRewrite" type="DistRewrite,App_Code"/>
</httpModules>
<authentication mode="Forms">
<forms name=".CallCenter" loginUrl="default.aspx" defaultUrl="default.aspx"/>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
<browserCaps>
<!-- GECKO Based Browsers (Netscape 6+, Mozilla/Firebird, ...) //-->
<case match="^Mozilla/5\.0 \([^)]*\) (Gecko/[-\d]+)? (?'type'[^/\d]*)([\d]*)/(?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*)).*">
browser=Gecko
type=${type}
frames=true
tables=true
cookies=true
javascript=true
javaapplets=true
ecmascriptversion=1.5
w3cdomversion=1.0
css1=true
css2=true
xml=true
tagwriter=System.Web.UI.HtmlTextWriter
supportsXmlHttp=true
supportsCallback=true
<case match="rv:(?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*))">
version=${version}
majorversion=${major}
minorversion=${minor}
<case match="^b" with="${letters}">
beta=true
</case>
</case>
</case>
</browserCaps>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
<httpHandlers>
<remove verb="*" path="*.asmx" />
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
<add path="ImgProvider.axd" verb="GET" type="BHW.XIOE.ImgProvider" />
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" />
</httpHandlers>
</system.web>
<location path="default.aspx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="emailwait.aspx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="reminder.aspx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="terms.aspx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="privacy.aspx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="page.aspx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="retailer/enroll_1.aspx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="retailer/enroll_2.aspx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="retailer/enroll_3.aspx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="retailer/agreement.aspx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="services">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="admin/reports.aspx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="services/CService.asmx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="retailer/batch.aspx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="test.aspx">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="ImgProvider.axd">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<location path="retailer/ImgProvider.axd">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
<HostMap>
<add key="localhost" value="corporate"/>
<add key="127.0.0.1" value="corporate"/>
<add key="default" value="corporate"/>
</HostMap>
<blowery.web>
<httpCompress preferredAlgorithm="gzip" compressionLevel="high">
<excludedMimeTypes>
<add type="image/png"/>
<add type="image/jpeg"/>
<add type="image/gif"/>
<add type="application/zip"/>
<add type="application/x-zip-compressed"/>
<add type="application/x-gzip-compressed"/>
<add type="application/x-compressed"/>
<add type="application/octet-stream"/>
<add type="application/pdf"/>
<add type="text/csv"/>
</excludedMimeTypes>
<excludedPaths>
<add path="Install/"/>
<add path="WebResource.axd"/>
</excludedPaths>
</httpCompress>
</blowery.web>
<log4net>
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="c:\temp\calltracker_lead.log"/>
<appendToFile value="true"/>
<rollingStyle value="Size"/>
<maxSizeRollBackups value="10"/>
<maximumFileSize value="4096KB"/>
<lockingModel type="log4net.Appender.FileAppender+MinimalLock"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline"/>
</layout>
</appender>
<!-- Set default logging level to DEBUG -->
<root>
<level value="DEBUG"/>
<appender-ref ref="RollingFileAppender"/>
</root>
<!-- Set logging for Spring to INFO. Logger names in Spring correspond to the namespace -->
<logger name="Spring">
<level value="INFO"/>
</logger>
<logger name="CallTracker">
<level value="INFO"/>
</logger>
</log4net>
<DistRewrite>
<add key="dow.aspx" value="DOW"/>
<add key="rsi.aspx" value="RSI"/>
<add key="cvs.aspx" value="CVS"/>
<add key="midstates.aspx" value="MidStates"/>
</DistRewrite>
</configuration>
Here is one of the mappings causing the error :
private IList<ProductGroup> productGroups = new List<ProductGroup>();
/// <summary>
/// these are the products this retailer has elected to sell
/// </summary>
[XmlIgnore, HasAndBelongsToMany(
Table = "productgroup_retailer",
ColumnKey = "retailer_id",
ColumnRef = "productgroup_id",
Cascade = ManyRelationCascadeEnum.SaveUpdate,
Lazy = true)]
public IList<ProductGroup> ProductGroups { get { return productGroups; } set { productGroups = value; } }
public IList<ProductGroup> ActiveProductGroups
{
get
{
List<ProductGroup> groups = new List<ProductGroup>(ProductGroups);
groups.RemoveAll(
delegate(ProductGroup group)
{
return !group.Active;
}
);
groups.Sort(delegate(ProductGroup a, ProductGroup b)
{
return a.Sequence.CompareTo(b.Sequence);
});
return groups;
}
}
|