Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Initializatin Error
myuserid
#1 Posted : Tuesday, 3 February 2009 3:21:33 PM(UTC)
Rank: Member

Joined: 3/02/2009(UTC)
Posts: 26
Location: Wisconsin

I'm using GSP with SQLServer and running into the following error when trying to access the gallery.

Object not set to the instance of an object (chuckle) Here's the stack trace


at GalleryServerPro.Business.AppSetting.DetermineIfDotNet3IsInstalled()
at GalleryServerPro.Business.AppSetting.Initialize(ApplicationTrustLevel trustLevel, String physicalAppPath, String mediaObjectPath, String thumbnailPath, String optimizedPath, String appName)
at GalleryServerPro.Web.Util.InitializeBusinessLayer()
at GalleryServerPro.Web.Util.InitializeApplication()

I'm using Dot.net 2 on localhost and the database install went just fine so I think the providers are working ok but...?

Looks like GSP is trying to figure out if I'm using Dot.net 3 and doesn't like the results. Any help would be greatly appreciated. Let me know if you need more info.

Thank you
Roger Martin
#2 Posted : Tuesday, 3 February 2009 11:50:03 PM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,167
Location: Fort Atkinson, WI

Is the error preventing the application from working? That exception will occur when .NET 3 or higher is not installed, but it should be caught by the initialization routine. It will attempt to send you an email but should otherwise allow the gallery to function normally.
Roger Martin
Creator and Lead Developer of Gallery Server Pro
myuserid
#3 Posted : Wednesday, 4 February 2009 12:41:25 AM(UTC)
Rank: Member

Joined: 3/02/2009(UTC)
Posts: 26
Location: Wisconsin

When this error occurs, the GSP error window appears showing the above stack trace, variables, etc. There is a link on the window that says return to gallery but when I click that link, I get the following error. BTW, I have the sendEmailOnError property set to false.

In the LoadRequestedPage() subroutine at the following line

Control control = LoadControl(src);

the error message is

The type initializer for 'GalleryServerPro.Web.Pages.GalleryPage' threw an exception.

I should mention that I'm attempting to integrate GSP into an existing application so I could easily have missed something in the setup.

Thanks for your help
Roger Martin
#4 Posted : Wednesday, 4 February 2009 1:11:43 AM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,167
Location: Fort Atkinson, WI

Check to see if you have GalleryServerPro.Business.Wpf.dll in your bin directory.
Roger Martin
Creator and Lead Developer of Gallery Server Pro
myuserid
#5 Posted : Wednesday, 4 February 2009 1:59:59 AM(UTC)
Rank: Member

Joined: 3/02/2009(UTC)
Posts: 26
Location: Wisconsin

yes, it's in the Bin directory.
myuserid
#6 Posted : Wednesday, 4 February 2009 5:41:05 AM(UTC)
Rank: Member

Joined: 3/02/2009(UTC)
Posts: 26
Location: Wisconsin

Well, after some more perusing of the database, I think I've found the problem but not sure exactly how to fix it. It seems that even though I changed the application name in the various providers of the web.config and GSP config file, GSP still created a new application entry in my aspnet_applications table, added my administrative user to the aspnet_Users table under the new application id and added the GSP system administrator role to the aspnet_Roles table under the new application id (also added a corresponding record in the aspnet_UsersInRoles table).

I'm working with pre-existing membership, role and profile providers (i.e. they existed in my app before adding Gallery Server Pro). Perhaps this has something to do with it so I'll add the configuration details that might be causing the problem.

Here's the data provider as specified in the gallery server pro config file

<dataProvider defaultProvider="SqlServerGalleryServerProProvider">
<providers>
<add applicationName="Satellite" connectionStringName="SystemFunctions"
name="SqlServerGalleryServerProProvider" type="GalleryServerPro.Data.SqlServer.SqlDataProvider" />
</providers>
</dataProvider>

SystemFunctions is a standard connection string for the local sqlserver

Next the membership provider...

<membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="120">
<providers>
<clear />
<add connectionStringName="SystemFunctions" applicationName="Satellite"
enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true"
requiresUniqueEmail="true" passwordFormat="Hashed" minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="0" passwordStrengthRegularExpression="^\S{7,14}$"
name="SqlProvider" type="System.Web.Security.SqlMembershipProvider" />
</providers>
</membership>

Next the Role Provider...

<roleManager enabled="true" defaultProvider="myRoleProvider">
<providers>
<clear />
<add connectionStringName="SystemFunctions" applicationName="Satellite"
name="myRoleProvider" type="System.Web.Security.SqlRoleProvider" />
</providers>
</roleManager>

And finally the profile provider

<profile enabled="true" defaultProvider="myProfileProvider">
<providers>
<clear />
<add connectionStringName="SystemFunctions" applicationName="Satellite"
name="myProfileProvider" type="System.Web.Profile.SqlProfileProvider" />
</providers>
<properties>

...additional properties here...

<add name="ShowMediaObjectMetadata" defaultValue="false" type="String"
allowAnonymous="true" />
</properties>
</profile>

Hopefully, this will shed some light on the matter. Seems like it should work to me but then again, it's not so...

Thanks again. This looks like a great program and it feels like it's very close to working so I'm hopeful that the above will help find the problem.

p.s. I just realized that this posting is not in the correct forum for which I whole-heartedly apologize. Richard
Roger Martin
#7 Posted : Wednesday, 4 February 2009 7:37:17 AM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,167
Location: Fort Atkinson, WI

Note: I moved the topic to the Dev forum.

It is hard to imagine how any kind of config setting can cause an exception within the DetermineIfDotNet3IsInstalled function. I also cannot imagine what can cause the specific error you are getting.

A few ideas:

1. Turn on the Visual Studio option to break on all exceptions; then run the app from Visual Studio. Perhaps you'll get an additional clue.

2. Configure email reporting. Since the app won't run, you'll have to manually update the relevant settings in galleryserverpro.config (sendEmailOnError, smtpServer, emailToAddress, emailFromAddress).

3. Use a debug version of the WPF dll so that when the error occurs, it will tell you the exact line where is failing. To do this, download the source code version of Gallery Server, compile it in debug mode, and place GalleryServerPro.Business.Wpf.dll *and* GalleryServerPro.Business.Wpf.pdb in your bin directory.
Roger Martin
Creator and Lead Developer of Gallery Server Pro
myuserid
#8 Posted : Wednesday, 4 February 2009 8:12:05 AM(UTC)
Rank: Member

Joined: 3/02/2009(UTC)
Posts: 26
Location: Wisconsin

Hi Roger,

I think this has something to do with the way the application set itself up in the database. As I stated in the previous post there are entries in the various membership tables (i.e. aspnet_applications, aspnet_users, etc.) that indicate two applications running instead of the one I would expect (i.e. my original application and the Gallery Server Pro application). GSP and my application should be running under the same application id (or at least that's how I envision it working). Seems like when the application got installed, it created a new application id and everything that goes along with it when what should have happened is that GSP should have used the existing application id. I'm going to run the debugging you suggested to see if it sheds further light but maybe the above will trigger an idea. Thanks. Richard
myuserid
#9 Posted : Wednesday, 4 February 2009 8:34:21 AM(UTC)
Rank: Member

Joined: 3/02/2009(UTC)
Posts: 26
Location: Wisconsin

I get an error in AppSettings.cs when I first try to access the page now at this line. It's another null reference exception. Also metadataExtractor is null at this point.

System.Reflection.MethodInfo addMetadataMethod = metadataExtractor.GetMethod("AddWpfBitmapMetadata", parmTypes);

This error only seems to occur the first time I try to load the gallery page. After that, were back to the original message on page reloads or refreshes.

Also, I don't have a mail server set up on my development PC so should I still try to set up the mail settings with dummy data?

Regarding the post above. Do you think I should try removing the second GSP application record and related records in my membership tables at this point?
Roger Martin
#10 Posted : Wednesday, 4 February 2009 11:38:10 AM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,167
Location: Fort Atkinson, WI

The error has nothing to do with the application name issue you refer to - at least I can't imagine how it could. In order to have the membership records you said you have in those tables, you must have run the GSP install wizard where one of the applicationName attributes was set to Gallery Server Pro. Since you changed the name, those records are no longer necessary and you may delete them.

That is helpful to report the line of code where the error is occurring, but it is baffling why it should fail. Here it is, along with the preceding line:

Code:
Type metadataExtractor = assembly.GetType("GalleryServerPro.Business.Wpf.WpfMetadataExtractor");
System.Reflection.MethodInfo addMetadataMethod = metadataExtractor.GetMethod("AddWpfBitmapMetadata", parmTypes);


We can conclude GSP is finding the GalleryServerPro.Business.Wpf.dll but, because metadataExtractor is null, cannot find the WpfMetadataExtractor class inside it. Did you happen to change the namespace and/or class name in the WPF project? That is the only explanation that makes sense.

If that's not it, I don't know what else to suggest except to go back to the drawing board and put your testing cap on. Start with a standard GSP release and get it working. Then slowly modify it by editing web.config, etc, until you arrive at your current app setup.
Roger Martin
Creator and Lead Developer of Gallery Server Pro
myuserid
#11 Posted : Thursday, 5 February 2009 1:24:16 AM(UTC)
Rank: Member

Joined: 3/02/2009(UTC)
Posts: 26
Location: Wisconsin

Question, when integrating with my existing application. Does the product key need to be installed for the GSP to work? I know that at this point, I do not have a product key installed. Grasping at straws here. Thanks.
myuserid
#12 Posted : Thursday, 5 February 2009 2:27:00 AM(UTC)
Rank: Member

Joined: 3/02/2009(UTC)
Posts: 26
Location: Wisconsin

Hi Roger,

Guess what? It's working! And I now know why it wasn't before. Seems this dummy sitting in my chair right now was using files from the source version that had not yet been compiled. I did compile the app to get the dll's but must have copied the other files before compiling. I replaced the files in the gs directory with the compiled versions and off it went. On a side note, I already had parts of the patterns and practices enterprise library installed in my app and had to update the object builder and common dlls with your versions to get things to work. Not sure why but then I'm not one to look a gift dll in the mouth. Sorry for the wild goose chase. Thanks for a great app. I'm looking forward to deploying it for our community users as soon as I've had a chance to get things configured correctly and tested. I'm thinking some kind of donation is in order as well. Thanks, Richard.
Roger Martin
#13 Posted : Thursday, 5 February 2009 11:07:18 AM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,167
Location: Fort Atkinson, WI

Glad you got it, Richard. And I definitely appreciate any donation you can throw my way. Cheers!
Roger Martin
Creator and Lead Developer of Gallery Server Pro
marty1101
#14 Posted : Wednesday, 20 May 2009 8:29:08 PM(UTC)
Rank: Advanced Member

Joined: 4/01/2009(UTC)
Posts: 37
Location: Taipei, Taiwan

I have had this error on and off for a few days and never knew why and how. This thread lead me through the problem.

I am not sure if I did the right thing.

[Using the source version]
In the \Website\Properties\Post-build event command line, I copy all GSP dlls including \Website\bin\GalleryServerPro.Business.Wpf.dll to MyWebsite\bin

Problem:
1. The size of GSP Website\bin\GalleryServerPro.Business.Wpf.dll is 10752
2. The size of MyWebsite\bin\GalleryServerPro.Business.Wpf.dll is 4068

In the Project Build Order, TIS.GSP.Business.Wpf is the last one (after Website). and TIS.GSP.Business.Wpf.Resources is before Website. That's the reason! After Website is compiled, the post-build command copies GalleryServerPro.Business.Wpf.dll to MyWebsite\bin\. The size of this file is 4068. Then TIS.GSP.Business.Wpf compiles and generate a new GalleryServerPro.Business.Wpf.dll in GSP Website\bin\

Temp solution:
In Project Dependencies, set Website depends on TIS.GSP.Business.Wpf. It makes Website compiles after TIS.GSP.Business.Wpf is compiled; and I get a final version of GalleryServerPro.Business.Wpf.dll

Question in mind:
1. Why does TIS.GSP.Business.Wpf compiles after Website? There is no dependency relationship between them.
2. Why do TIS.GSP.Business.Wpf and TIS.GSP.Business.Wpf.Resources generate the same file name:
GalleryServerPro.Business.Wpf.dll ?

In the end, it was really difficult to come to the solution, after trying to debug the source code finding not much related to the cause. I have to say that I have very little experience dealing with so many related projects(including CommunityServer's) in a VS solution. The thing is getting more and more complicated, but more exciting though.

Roger Martin
#15 Posted : Thursday, 21 May 2009 1:26:06 AM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,167
Location: Fort Atkinson, WI

Quote:
1. Why does TIS.GSP.Business.Wpf compiles after Website? There is no dependency relationship between them.


This dll depends on .NET 3.0. Since some users install GSP on a .NET 2.0 system, this dll is invoked via reflection and gracefully degrades when 3.0 is not present. To achieve this, rather than use a project reference, I set the output path to ..\Website\bin\ in the Wpf project settings. That copies the dll to the website when it is compiled, and it does not matter if it happens before or after the website compiles.

Having said that, it is logical to have the Website compile last, so I will make that change in my project.

At some point in the future, GSP will have a higher .NET version requirement, and at that time this project will no longer be necessary.

Quote:
2. Why do TIS.GSP.Business.Wpf and TIS.GSP.Business.Wpf.Resources generate the same file name:
GalleryServerPro.Business.Wpf.dll ?


Not true. The Wpf.Resources project generates a dll with the name GalleryServerPro.Business.Wpf.resources.dll and it is copied to the nl directory in the bin folder of the website project. Why "nl"? The resource projects (Wpf.Resources and Business.Resources) contain translations for text, and I had to pick a non-English culture, and Dutch was the first one that came to mind.

Hope this helps...
Roger Martin
Creator and Lead Developer of Gallery Server Pro
marty1101
#16 Posted : Thursday, 21 May 2009 1:12:17 PM(UTC)
Rank: Advanced Member

Joined: 4/01/2009(UTC)
Posts: 37
Location: Taipei, Taiwan

Out of curiosity, I reproduced the situation again.

1. Delete TIS.GSP.Business.Wpf.Resources\obj
2. Delete TIS.GSP.Business.Wpf\obj
3. Compile the solution

Found :
1. TIS.GSP.Business.Wpf.Resources\obj\Debug\GalleryServerPro.Business.Wpf.dll Size:4608
2. TIS.GSP.Business.Wpf\obj\Debug\GalleryServerPro.Business.Wpf.dll Size:10752
3. MyWebsite\bin\GalleryServerPro.Business.Wpf.dll Size:4608

Somehow, after \Website is compiled, (1) is copied to \Website\bin\ and my command copies \Website\bin\GalleryServerPro.Business.Wpf.dll to (3). Then, (2) is copied to Website\bin\

I can't tell how it happens. A few guesses:
1. In TIS.GSP.Business.Wpf.Resources Properties\Application\Assembly name = GalleryServerPro.Business.Wpf
2. The output path of TIS.GSP.Business.Wpf.Resources = ..\Website\bin\
3. In Project Dependencies, TIS.GSP.Business.Wpf depends on TIS.GSP.Business.Wpf.Resources

Still have no clue where this file was coming from:
TIS.GSP.Business.Wpf.Resources\obj\Debug\GalleryServerPro.Business.Wpf.dll Size:4608


Roger Martin
#17 Posted : Thursday, 21 May 2009 1:52:13 PM(UTC)
Roger Martin

Rank: Administration

Joined: 3/08/2007(UTC)
Posts: 3,167
Location: Fort Atkinson, WI

I see what you are saying. I don't know why the resource projects want to create a dll with the same name as the other project - in the end they are not used. The only one that is important is the one they put in the nl directory.

Given your scenario of copying dll's after the website compiles, it is definitely important that the website be the last one to compile so that the "empty" resource-created dll's are overwritten with the real ones.

I will make the change to my solution so the website is the last one to build.
Roger Martin
Creator and Lead Developer of Gallery Server Pro
Rss Feed  Atom Feed
Users browsing this topic
Guest
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.