iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hi,
I've been stuck on the following problem for a week and it's driving me nuts! Please help.
The code below works fine on my development machine (VS 2010 .NET 4.0) but continues to fail on the server (IIS 7 .NET 4.0 RAM: 4GB). Basically I'm trying to bind my grid with an ObjectDataSource using a DataSet, or even a DataTable. Simple task!
aspx:
<%@ Page Title="Home Page" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.vb" Inherits="TestWebGrid._Default" %> <%@ MasterType VirtualPath="~/Site.Master" %> <%@ Register Assembly="ISNet.WebUI.WebGrid" Namespace="ISNet.WebUI.WebGrid" TagPrefix="ISWebGrid" %> <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> </asp:Content> <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <ISWebGrid:WebGrid ID="myGrid" runat="server" Height="300px" Width="100%" UseDefaultStyle="true" DataSourceID="odsMyList"> <RootTable GridLineStyle="NotSet" DataKeyField="some_id"> <Columns> <ISWebGrid:WebGridColumn Name="some_id" DataMember="some_id"/> </Columns> </RootTable> <LayoutSettings GridLines="Default" AllowDelete="No" AllowEdit="No" AllowAddNew="No" > </LayoutSettings> </ISWebGrid:WebGrid> <asp:ObjectDataSource ID="odsMyList" runat="server" TypeName="WebGridBLL.WebGridManager" SelectMethod="GetData"> <SelectParameters> <asp:Parameter DefaultValue="0" Name="myParam" Type="String" /> </SelectParameters> </asp:ObjectDataSource> </asp:Content>
There's nothing to do in the code behind of the ASPX.
My BLL is in the same solution and the references are added fine.
BLL:
Imports System.Data Imports System.Data.SqlClient Public Class WebGridManager ' note blocked out connection string Private ReadOnly _connectionString As String = "XXX" Public csbaData As DataSet Public Sub New() End Sub ''' <summary> ''' ''' </summary> ''' <returns></returns> ''' <remarks></remarks> Public Function GetData(ByVal myParam As String) As DataSet csbaData = New DataSet Dim connectionString As String = _connectionString Dim conn As New SqlConnection(connectionString) conn.Open() Try Dim command As New SqlCommand("SELECT * FROM MyTable", conn) command.CommandType = System.Data.CommandType.Text Dim da As New SqlDataAdapter(command) da.Fill(csbaData) Finally If Not IsNothing(conn) Then If conn.State <> ConnectionState.Closed Then conn.Close() conn.Dispose() End If End If End Try Return csbaData End Function End Class
The error I get on the server:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.] System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type) +0 System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) +67 System.Web.UI.Util.GetTypeFromAssemblies(IEnumerable assemblies, String typeName, Boolean ignoreCase) +146 System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +8940004 System.Web.UI.WebControls.ObjectDataSourceView.GetType(String typeName) +76 System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1812 System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +21 System.Web.UI.WebControls.DataBoundControl.PerformSelect() +143 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74 System.Web.UI.WebControls.GridView.DataBind() +4 System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +66 System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +75 System.Web.UI.Control.EnsureChildControls() +102 System.Web.UI.Control.PreRenderRecursiveInternal() +42 System.Web.UI.Control.PreRenderRecursiveInternal() +175 System.Web.UI.Control.PreRenderRecursiveInternal() +175 System.Web.UI.Control.PreRenderRecursiveInternal() +175 System.Web.UI.Control.PreRenderRecursiveInternal() +175 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496
I know this isn't a memory issue because I can bind the grid using a SqlDataSource, but we really need to use the ObjectDataSource here. I'm also only loading 19 records to the grid.
Your help is greatly appreciated.
The problem is resolved (Phew)Yudi and I walked through the deployment issue and it boiled down to Web.Config settings
<?xml version="1.0"?><!-- For more information on how to configure your ASP.NET application, please visit http://go.microsoft.com/fwlink/?LinkId=169433 --> <configuration> <configSections> </configSections> <appSettings file=""> <clear /> <add key="ISNet.WebUI.ISRes_Registered" value="true" /> <add key="ISNet.WebUI.WebGrid.v7_0_7200.RunTimeLicenseKey" value="xxxxx-xxxx-xxxxx" /> <add key="ISNet.WebUI.WebGrid.v7_0_7200.SharedScriptDirectory" value="~/CommonLibrary/Shared/" /> <add key="ISNet.WebUI.WebGrid.v7_0_7200.ScriptDirectory" value="~/CommonLibrary/WebGrid/V7_0_7200/" /> <add key="ISNet.WebUI.WebGrid.v7_0_7200.ImagesDirectory" value="~/CommonLibrary/Images/" /> <add key="AppName" value="AARS" /> </appSettings> <system.web> <customErrors defaultRedirect="/Errors/Oops.aspx" mode="On"> </customErrors> <compilation debug="true" strict="false" explicit="true" targetFramework="4.0"> <assemblies> <!-- make sure there are no ISnet References in here --> </assemblies> </compilation> <authorization> <deny users="?" /> </authorization> <authentication mode="Forms"> <forms loginUrl="~/Login" timeout="2880" name=".ASPXAUTH" protection="All"/> </authentication> <membership> <providers> <clear/> <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/> </providers> </membership> <profile> <providers> <clear/> <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/> </providers> </profile> <roleManager enabled="false"> <providers> <clear/> <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/"/> <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/> </providers> </roleManager> <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/> </system.web> <system.webServer> <modules/> <validation validateIntegratedModeConfiguration="false"/> <handlers><!-- this is key --><add name="ISRes.axd_GET" path="ISRes.axd" verb="GET" type="ISNet.WebUI.WebResourceHandler, ISNet.WebUI, Version=3.0.5000.1, Culture=neutral, PublicKeyToken=b1f2a8511635667a" preCondition="integratedMode"/> </handlers> </system.webServer> </configuration>
As stated in your initial message that the code works fine on the development machine but not on the server, could you please try to bind ASP.NET GridView to the odsMyList ASP.NET ObjectDataSource control in the server and let us know whether it works or not?
Look forward to hearing back from you.
Hi Yudi,I've actually tried that too and it also does not work. I was hoping you can offer some insight. I am wondering if there's some setting I'm missing or if my implementation is just bad.
I should mention I'm using WebGrid 7.0.7200.431. I'm running the application under a .NET 4.0 Classic Application Pool.
Hi Yudi,Turns out this may be a WebGrid Specific error. Here's how I've come to this conclusion:I took out all references to the webgrid project and deployed with a regular .NET grid to my prod server and I got the site to display. Then I re-added all webgrid references back to the project, but still kept the regular .net grid. Deployed and I got the OutOfMemoryException error. Is there something I need to add to my web.config ? IIS?my webconfig is attached:
<?xml version="1.0"?><!-- For more information on how to configure your ASP.NET application, please visit http://go.microsoft.com/fwlink/?LinkId=169433 --> <configuration> <appSettings> <clear/> <add key="ISNet.WebUI.ISRes_Registered" value="true"/> <add key="ISNet.WebUI.WebGrid.v7_0_7200.RunTimeLicenseKey" value="XXX"/> <add key="ISNet.WebUI.WebGrid.v7_0_7200.SharedScriptDirectory" value="~/CommonLibrary/Shared/"/> <add key="ISNet.WebUI.WebGrid.v7_0_7200.ScriptDirectory" value="~/CommonLibrary/WebGrid/V7_0_7200/"/> <add key="ISNet.WebUI.WebGrid.v7_0_7200.ImagesDirectory" value="~/CommonLibrary/Images/"/> </appSettings> <connectionStrings> <!--<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />--> </connectionStrings> <system.web> <compilation debug="true" strict="false" explicit="true" targetFramework="4.0"> <assemblies> <add assembly="ISNet.ActiveReports.Exporting, Version=5.0.7200.1, Culture=neutral, PublicKeyToken=B1F2A8511635667A"/> <add assembly="ISNet.WebUI, Version=3.0.5000.1, Culture=neutral, PublicKeyToken=B1F2A8511635667A"/> <add assembly="ISNet, Version=3.0.5000.1, Culture=neutral, PublicKeyToken=B1F2A8511635667A"/> <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> </assemblies> </compilation> <!--<authentication mode="Forms"> <forms loginUrl="~/Account/Login.aspx" timeout="2880" /> </authentication>--> <membership> <providers> <clear/> <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/> </providers> </membership> <profile> <providers> <clear/> <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/> </providers> </profile> <roleManager enabled="false"> <providers> <clear/> <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/"/> <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/> </providers> </roleManager> <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/> </system.web> <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> </system.webServer> </configuration>
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname