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

Notification

Icon
Error

Trying to use GSP with VB.Net
meigs
#1 Posted : Saturday, 9 January 2010 3:20:25 AM(UTC)
Rank: Advanced Member

Joined: 16/03/2008(UTC)
Posts: 86
Man
Location: Pennsylvania

This is related to the last post. I wrote a utility in VB.Net to run GSP ... The physical application path I am using is to the root of the website where the web.config file is located. The error I get says that it cant find the core information in the galleryserverpro.config file. I think I must be having troubles with right paths. Is there anything else I cam missing for the initialiation? I have all references to the .dlls. Does the code go to web.config to get information or for an application should it be app.config?

Code: ------------------------------------------------------------------

Dim PhysicalApplicationPath As String

PhysicalApplicationPath = "C:\inetpub\GalleryServerPro_V2_3_3512_source\Website\"
Dim GSPAppName As String = "Gallery Server Pro"

Dim trustlevel As GalleryServerPro.Business.ApplicationTrustLevel = GalleryServerPro.Business.ApplicationTrustLevel.Full
GalleryServerPro.Business.AppSetting.Instance.Initialize(trustlevel, PhysicalApplicationPath, GSPAppName)

Dim alb As GalleryServerPro.Business.Interfaces.IAlbum

Dim aid As Integer
aid = 3

alb = GalleryServerPro.Business.Factory.LoadAlbumInstance(aid, False)


Debug.Print(alb.Title)

alb.Dispose()
Roger Martin
#2 Posted : Sunday, 10 January 2010 1:14:37 PM(UTC)
Roger Martin

Rank: Administration

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

If you are writing a utility rather than a web app then your program needs app.config, not web.config. Below is an example of an app.config I wrote for a little utility I wrote in 2008. Some of the config settings in the galleryServerPro section have changed since then, so you'll need to update it to match the latest version in galleryserverpro.config, but it should get you on the right path.

<?xml version="1.0"?>
<configuration>
<configSections>
<section name="galleryServerPro" type="GalleryServerPro.Configuration.GalleryServerProConfigSettings, GalleryServerPro.Configuration" allowDefinition="MachineToApplication" requirePermission="false"/>
<section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings, Microsoft.Practices.EnterpriseLibrary.Caching" requirePermission="false" />
</configSections>

<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>

<connectionStrings>
<add name="SQLiteDbConnection" connectionString="Data Source=C:\Development\TIS.GSP\gsweb\App_Data\galleryserverpro_data.sqlite;Version=3;" />
<add name="SqlServerDbConnection" connectionString="server=YourServerName;Trusted_Connection=yes;database=GalleryServerPro;Application Name=Gallery Server Pro" />
</connectionStrings>

<cachingConfiguration defaultCacheManager="Cache Manager">
<cacheManagers>
<add expirationPollFrequencyInSeconds="60" maximumElementsInCacheBeforeScavenging="1000" numberToRemoveWhenScavenging="10" backingStoreName="Null Storage" name="Cache Manager" />
</cacheManagers>
<backingStores>
<add encryptionProviderName="" type="Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.NullBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching" name="Null Storage" />
</backingStores>
</cachingConfiguration>

<galleryServerPro>
<core galleryId="1" mediaObjectPath="C:\Development\TIS.GSP\gsweb\mediaobjects" websiteTitle="Gallery Server Pro"
pageHeaderText="My Media Gallery" pageHeaderTextUrl="~/" defaultAlbumDirectoryName="DefaultName"
defaultAlbumDirectoryNameLength="25" synchAlbumTitleAndDirectoryName="true"
emptyAlbumThumbnailBackgroundColor="#369" emptyAlbumThumbnailText="Empty"
emptyAlbumThumbnailFontName="Verdana" emptyAlbumThumbnailFontSize="13"
emptyAlbumThumbnailFontColor="White" emptyAlbumThumbnailWidthToHeightRatio="1.33"
maxAlbumThumbnailTitleDisplayLength="20" maxMediaObjectThumbnailTitleDisplayLength="16"
allowHtmlInTitlesAndCaptions="false" mediaObjectTransitionType="Fade"
mediaObjectTransitionDuration="0.2" slideshowInterval="4000"
mediaObjectDownloadBufferSize="32768" encryptMediaObjectUrlOnClient="true"
encryptionKey="Eig-t/1oF2lzs}BDGw74R-Ti" allowUnspecifiedMimeTypes="false"
imageTypesStandardBrowsersCanDisplay=".jpg,.jpeg,.gif,.png" allowAnonymousHiResViewing="true"
enableImageMetadata="true" enableWpfMetadataExtraction="true"
enableMediaObjectDownload="true" enablePermalink="true" enableSlideShow="true"
maxThumbnailLength="115" thumbnailImageJpegQuality="70" thumbnailClickShowsOriginal="false"
thumbnailWidthBuffer="30" thumbnailHeightBuffer="65" thumbnailFileNamePrefix="zThumb_"
thumbnailPath="C:\Development\TIS.GSP\gsweb\mediaobjects" maxOptimizedLength="640" optimizedImageJpegQuality="70"
optimizedImageTriggerSizeKB="50" optimizedFileNamePrefix="zOpt_"
optimizedPath="C:\Development\TIS.GSP\gsweb\mediaobjects" originalImageJpegQuality="95" applyWatermark="false"
applyWatermarkToThumbnails="false" watermarkText="Copyright 2008, Your Company Name, All Rights Reserved"
watermarkTextFontName="Verdana" watermarkTextFontSize="13" watermarkTextWidthPercent="50"
watermarkTextColor="White" watermarkTextOpacityPercent="35" watermarkTextLocation="BottomCenter"
watermarkImagePath="images/gsplogo.png" watermarkImageWidthPercent="85"
watermarkImageOpacityPercent="25" watermarkImageLocation="MiddleCenter"
sendEmailOnError="false" emailFromName="Gallery Server Pro" emailFromAddress="webmaster@yourisp.com"
emailToName="Gallery Server Pro Administrator" emailToAddress="name@yourisp.com"
smtpServer="" smtpServerPort="" autoStartMediaObject="false"
defaultVideoPlayerWidth="640" defaultVideoPlayerHeight="480"
defaultAudioPlayerWidth="600" defaultAudioPlayerHeight="60" defaultGenericObjectWidth="640"
defaultGenericObjectHeight="480" maxUploadSize="2097151" allowAddLocalContent="true"
allowAddExternalContent="true" productKey="" />
<galleryObject>
<mediaObjects>
<mediaObject mimeType="image/*">
<browsers>
<browser id="default" htmlOutput="&lt;div class=&quot;op1&quot;&gt;&lt;div class=&quot;op2&quot;&gt;&lt;div class=&quot;sb&quot;&gt;&lt;div class=&quot;ib&quot;&gt;&lt;img id=&quot;mo_img&quot; src=&quot;{MediaObjectUrl}&quot; class=&quot;{CssClass}&quot; alt=&quot;{TitleNoHtml}&quot; title=&quot;{TitleNoHtml}&quot; style=&quot;height:{Height}px;width:{Width}px;&quot; /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;" />
</browsers>
</mediaObject>

... rest of mediaObject tags skipped for brevity...

</mediaObjects>
<mimeTypes>
<mimeType fileExtension=".afl" browserId="default" type="video/animaflex"
allowAddToGallery="false" />

... rest of mimeType tags skipped for brevity...

<mimeType fileExtension=".zip" browserId="default" type="application/application/x-zip-compressed"
allowAddToGallery="false" />
</mimeTypes>
</galleryObject>
<dataStore albumTitleLength="200" albumDirectoryNameLength="255"
albumSummaryLength="1500" mediaObjectTitleLength="1000" mediaObjectFileNameLength="255"
mediaObjectHashKeyLength="47" mediaObjectExternalHtmlSourceLength="1000"
mediaObjectExternalTypeLength="15" mediaObjectMetadataDescriptionLength="100"
mediaObjectMetadataValueLength="2000" roleNameLength="256" ownedByLength="256"
createdByLength="256" lastModifiedByLength="256" />
<dataProvider defaultProvider="SqlServerGalleryServerProProvider">
<providers>
<add applicationName="Gallery Server Pro" connectionStringName="SQLiteDbConnection"
name="SQLiteGalleryServerProProvider" type="GalleryServerPro.Data.SQLite.SQLiteGalleryServerProProvider, GalleryServerPro.Data.SQLite" />
<add applicationName="Gallery Server Pro" connectionStringName="SqlServerDbConnection"
name="SqlServerGalleryServerProProvider" type="GalleryServerPro.Data.SqlServer.SqlDataProvider, GalleryServerPro.Data.SqlServer" />
</providers>
</dataProvider>
</galleryServerPro>

</configuration>
Roger Martin
Creator and Lead Developer of Gallery Server Pro
meigs
#3 Posted : Monday, 11 January 2010 9:55:28 AM(UTC)
Rank: Advanced Member

Joined: 16/03/2008(UTC)
Posts: 86
Man
Location: Pennsylvania

Thanks I will give it a try and let you know what happens.
meigs
#4 Posted : Saturday, 30 January 2010 7:03:25 AM(UTC)
Rank: Advanced Member

Joined: 16/03/2008(UTC)
Posts: 86
Man
Location: Pennsylvania

I get closer but it is still not working. I have a test program ... I think there is something very simple I must be missing, I really would like this to work and any suggestions would be appreciated.:

Dim PhysicalApplicationPath As String
PhysicalApplicationPath = "C:\Users\monty\Desktop\VBProjects\GSPApp\GSPVB-Application\GSPVB-Application\"
Dim GSPAppName As String = "Gallery Server Pro"

Dim trustlevel As GalleryServerPro.Business.ApplicationTrustLevel = GalleryServerPro.Business.ApplicationTrustLevel.Full

GalleryServerPro.Business.AppSetting.Instance.Initialize(trustlevel, PhysicalApplicationPath, GSPAppName)
Dim aid As Integer
aid = 3
Dim album As GalleryServerPro.Business.Interfaces.IAlbum
album = GalleryServerPro.Business.Factory.LoadAlbumInstance(aid, False)
Debug.Print(album.Title)
album.Dispose()

------------ I step through in debug mode and it throws an exception at this line:

Factory.GetDataProvider().InitializeDataStore();

------------ It looks like things are read from the app.config file ok, I checked to make sure sql database connection works with user / password and it is ok. Below is what is in the app.config file...


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

<configSections>
<section name="galleryServerPro" type="GalleryServerPro.Configuration.GalleryServerProConfigSettings, GalleryServerPro.Configuration" allowDefinition="MachineToApplication" requirePermission="false"/>
<section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings, Microsoft.Practices.EnterpriseLibrary.Caching" requirePermission="false" />
</configSections>

<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>

<connectionStrings>
<add name="SqlServerDbConnection" connectionString="server=laptop1\sqlexpress;uid=xxxxx;pwd=xxxxx;Trusted_Connection=yes;database=gsp1;Application Name=Gallery Server Pro"/>
</connectionStrings>

<cachingConfiguration defaultCacheManager="Cache Manager">
<cacheManagers>
<add expirationPollFrequencyInSeconds="60" maximumElementsInCacheBeforeScavenging="1000" numberToRemoveWhenScavenging="10" backingStoreName="Null Storage" name="Cache Manager" />
</cacheManagers>
<backingStores>
<add encryptionProviderName="" type="Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.NullBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching" name="Null Storage" />
</backingStores>
</cachingConfiguration>



<galleryServerPro>
<core galleryId="1"
mediaObjectPath="C:\Users\Public\Pictures\Library\original\"
mediaObjectPathIsReadOnly="false"
pageHeaderText="Media Gallery"
pageHeaderTextUrl="~/"
showLogin="true"
showSearch="true"
showErrorDetails="false"
enableExceptionHandler="true"
defaultAlbumDirectoryNameLength="25"
synchAlbumTitleAndDirectoryName="true"
emptyAlbumThumbnailBackgroundColor="#369"
emptyAlbumThumbnailText="Empty"
emptyAlbumThumbnailFontName="Verdana"
emptyAlbumThumbnailFontSize="13"
emptyAlbumThumbnailFontColor="White"
emptyAlbumThumbnailWidthToHeightRatio="1.33"
maxAlbumThumbnailTitleDisplayLength="20"
maxMediaObjectThumbnailTitleDisplayLength="16"
allowHtmlInTitlesAndCaptions="false"
allowUserEnteredJavascript="false"
allowedHtmlTags="p, a, div, span, br, ul, ol, li, table, tr, td, th, h1, h2, h3, h4, h5, h6, strong, b, em, i, u, cite, blockquote, address, pre, hr, img, dl, dt, dd, code, tt"
allowedHtmlAttributes="href, class, style, id, src, title, alt, target, name"
allowCopyingReadOnlyObjects="false"
allowManageOwnAccount="true"
allowDeleteOwnAccount="true"
mediaObjectTransitionType="Fade"
mediaObjectTransitionDuration="0.2"
slideshowInterval="4000"
mediaObjectDownloadBufferSize="32768"
encryptMediaObjectUrlOnClient="true"
encryptionKey=":PvNz{!F[WK|1d@gIaTYY80a"
allowUnspecifiedMimeTypes="false"
imageTypesStandardBrowsersCanDisplay=".jpg,.jpeg,.gif,.png"
silverlightFileTypes=".mp3,.wma,.wmv,.asf,.asx,.mp4,.m4a"
allowAnonymousHiResViewing="true"
enableImageMetadata="true"
enableWpfMetadataExtraction="true"
enableMediaObjectDownload="true"
enableMediaObjectZipDownload="true"
enablePermalink="true"
enableSlideShow="true"
maxThumbnailLength="115"
thumbnailImageJpegQuality="70"
thumbnailClickShowsOriginal="false"
thumbnailWidthBuffer="30"
thumbnailHeightBuffer="70"
thumbnailFileNamePrefix="zThumb_"
thumbnailPath="C:\Users\Public\Pictures\Library\thumbnail\"
maxOptimizedLength="640"
optimizedImageJpegQuality="70"
optimizedImageTriggerSizeKB="50"
optimizedFileNamePrefix="zOpt_"
optimizedPath="C:\Users\Public\Pictures\Library\compressed\"
originalImageJpegQuality="95"
discardOriginalImageDuringImport="false"
applyWatermark="false"
applyWatermarkToThumbnails="false"
watermarkText="Copyright 2009, Your Company Name, All Rights Reserved"
watermarkTextFontName="Verdana"
watermarkTextFontSize="13"
watermarkTextWidthPercent="50"
watermarkTextColor="White"
watermarkTextOpacityPercent="35"
watermarkTextLocation="BottomCenter"
watermarkImagePath="gs/images/gsplogo.png"
watermarkImageWidthPercent="85"
watermarkImageOpacityPercent="25"
watermarkImageLocation="MiddleCenter"
sendEmailOnError="true"
emailFromName="Gallery Server Pro"
emailFromAddress="webmaster@yourisp.com"
emailToName="Gallery Server Pro Administrator"
emailToAddress="name@yourisp.com"
smtpServer=""
smtpServerPort=""
sendEmailUsingSsl="false"
autoStartMediaObject="false"
defaultVideoPlayerWidth="640"
defaultVideoPlayerHeight="480"
defaultAudioPlayerWidth="600"
defaultAudioPlayerHeight="60"
defaultGenericObjectWidth="640"
defaultGenericObjectHeight="480"
maxUploadSize="2097151"
allowAddLocalContent="true"
allowAddExternalContent="true"
allowAnonymousBrowsing="true"
pageSize="0"
pagerLocation="TopAndBottom"
maxNumberErrorItems="200"
enableSelfRegistration="false"
requireEmailValidationForSelfRegisteredUser="false"
requireApprovalForSelfRegisteredUser="false"
useEmailForAccountName="false"
defaultRolesForSelfRegisteredUser=""
usersToNotifyWhenAccountIsCreated=""
enableUserAlbum="false"
userAlbumParentAlbumId="0"
userAlbumNameTemplate="{UserName}'s gallery"
userAlbumSummaryTemplate="Welcome to your personal gallery. You can easily add photos, video, and other files. When you are logged in, an Actions menu appears in the upper left to help you manage your gallery."
redirectToUserAlbumAfterLogin="false"
jQueryScriptPath="/script/jquery-1.3.2.min.js"
membershipProviderName=""
roleProviderName=""
productKey="thankyou" />
<galleryObject>

<mediaObjects>
<clear />
<mediaObject
mimeType="image/*">
<browsers>
<browser
id="default"
htmlOutput="&lt;div class=&quot;gsp_floatcontainer&quot;&gt;&lt;div class=&quot;op1&quot;&gt;&lt;div class=&quot;op2&quot;&gt;&lt;div class=&quot;sb&quot;&gt;&lt;div class=&quot;ib&quot;&gt;&lt;img id=&quot;mo_img&quot; src=&quot;{MediaObjectUrl}&quot; class=&quot;{CssClass}&quot; alt=&quot;{TitleNoHtml}&quot; title=&quot;{TitleNoHtml}&quot; style=&quot;height:{Height}px;width:{Width}px;&quot; /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;" />
</browsers>
</mediaObject>
<mediaObject
mimeType="audio/*">
<browsers>
<browser
id="default"
htmlOutput="&lt;object type=&quot;{MimeType}&quot; data=&quot;{MediaObjectUrl}&quot; style=&quot;width:{Width}px;height:{Height}px;&quot; &gt; &lt;param name=&quot;autostart&quot; value=&quot;{AutoStartMediaObjectInt}&quot; /&gt; &lt;param name=&quot;controller&quot; value=&quot;true&quot; /&gt;&lt;/object&gt;" />
<browser
id="ie"
htmlOutput="&lt;object classid=&quot;clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6&quot; standby=&quot;Loading audio...&quot; style=&quot;width:{Width}px;height:{Height}px;&quot;&gt;&#x9;&lt;param name=&quot;url&quot; value=&quot;{MediaObjectUrl}&quot; /&gt;&#x9;&lt;param name=&quot;src&quot; value=&quot;{MediaObjectUrl}&quot; /&gt;&#x9;&lt;param name=&quot;autostart&quot; value=&quot;{AutoStartMediaObjectText}&quot; /&gt;&#x9;&lt;param name=&quot;showcontrols&quot; value=&quot;true&quot; /&gt;&lt;/object&gt;" />
</browsers>
</mediaObject>

</mediaObjects>

</galleryObject>


--------------DELETED LOTS OF THE MEDIA OBJECT REFERENCES TO REDUCE SIZE...










<dataStore
albumTitleLength="200"
albumDirectoryNameLength="255"
albumSummaryLength="1500"
mediaObjectTitleLength="1000"
mediaObjectFileNameLength="255"
mediaObjectHashKeyLength="47"
mediaObjectExternalHtmlSourceLength="1000"
mediaObjectExternalTypeLength="15"
mediaObjectMetadataDescriptionLength="100"
mediaObjectMetadataValueLength="2000"
roleNameLength="256"
ownedByLength="256"
ownerRoleNameLength="256"
createdByLength="256"
lastModifiedByLength="256"
errorExTypeLength="1000"
errorExMsgLength="4000"
errorExSourceLength="1000"
errorUrlLength="1000" />

<dataProvider
defaultProvider="SqlServerGalleryServerProProvider">
<providers>
<clear />
<add
applicationName="Gallery Server Pro"
connectionStringName="SqlServerDbConnection"
name="SqlServerGalleryServerProProvider"
type="GalleryServerPro.Data.SqlServer.SqlDataProvider" />
</providers>
</dataProvider>


</galleryServerPro>


</configuration>




Roger Martin
#5 Posted : Sunday, 31 January 2010 2:47:21 PM(UTC)
Roger Martin

Rank: Administration

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

What are the full details of the error you are getting?

It seems odd to me that your config file does not define the membership, role, or profile providers. I verified that the app I wrote in 2008 didn't either, and it worked, so maybe it isn't needed, but at the moment it seems like they should be there. Then again, those sections are defined in a <system.web> element in the web.config of GSP, so how does that work with app.config (does an app.config still have a <system.web> section?).

It is late, I am tired, and I don't have time to research these issues, but maybe they can help you get to the bottom of this.
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.