How to use System.Configuration.ConfigurationManager.AppSettings("keyName")?
Hi to all
despite hunting the forums and editing multiple configs I have yet to find an answer to this question.
Within a Workflow , how do you make use of System.Configuration.ConfigurationManager.AppSettings("keyName")?
This is one of the 'Intellisense' items that pops up during the setting of a variable in an Alert for example.
Which config file should be edited to make use of this setting so that I can copy a workflow from a dev environment to a live environment and have the workflow refernece a setting that is global for all workflows on that server.
Despite editing various web.config files (and restarting AppPools) I have yet to get a new AppSetting key value to show up.
Any suggestions would be appreciated.
Regards
Ralph
-
[Gcx Essentials Instance]\REST Elemetns\REST\Web.config is the one, where [Gcx Essentials Instance] is as defaults 'C:\Program Files (x86)\Latitude Geographics\Geocortex Essentials\Defaults\'.
0 -
Hi Ralph,
The app settings need to be defined in the REST/web.config file to be available to a workflow running in Essentials. There is no need to restart the app pool after making a change to the web.config. Simply saving the file will restart the web application.
If you want your app settings to be available in the Workflow Simulator you will also need to add them to the Geocortex.Workflow.Designer.exe.config file of the Workflow Designer application and then restart the designer.
--Ryan
0 -
Hi Ryan and Munwhan
The server that I am trying to make use of this on has two instances; Default and External.
I have added to
- C:\Program Files (x86)\Latitude Geographics\Geocortex Essentials\Default\REST Elements\REST\web.config and
/customer/servlet/servlet.FileDownload?file=00P6000000elthREAQ
- C:\Program Files (x86)\Latitude Geographics\Geocortex Essentials\External\REST Elements\REST\web.config
as well as:
- C:\Program Files (x86)\Latitude Geographics\Geocortex Essentials\Default\Workflow Designer\Geocortex.Workflow.Designer.exe.config and
- C:\Program Files (x86)\Latitude Geographics\Geocortex Essentials\External\Workflow Designer\Geocortex.Workflow.Designer.exe.config
I have created a workflow to test this:
<Activity mc:Ignorable="sap sads" x:Class="{x:Null}" sap:VirtualizedContainerService.HintSize="273,286" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces"
xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities"
xmlns:eac="clr-namespace:ESRI.ArcGIS.Client;assembly=ESRI.ArcGIS.Client"
xmlns:eacg="clr-namespace:ESRI.ArcGIS.Client.Geometry;assembly=ESRI.ArcGIS.Client"
xmlns:eact="clr-namespace:ESRI.ArcGIS.Client.Tasks;assembly=ESRI.ArcGIS.Client"
xmlns:gce="clr-namespace:Geocortex.Core.Extensions;assembly=Geocortex.Core"
xmlns:gfc="clr-namespace:Geocortex.Forms.Client;assembly=Geocortex.EssentialsWpfApi"
xmlns:gfci="clr-namespace:Geocortex.Forms.Client.Items;assembly=Geocortex.EssentialsWpfApi"
xmlns:gr="clr-namespace:Geocortex.Reporting;assembly=Geocortex.Reporting"
xmlns:gwa="clr-namespace:Geocortex.Workflow.Activities;assembly=Geocortex.Workflow"
xmlns:gwa1="clr-namespace:Geocortex.Workflow.Activities;assembly=Geocortex.Workflow.Activities"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities"
xmlns:s="clr-namespace:System;assembly=System.Core"
xmlns:s1="clr-namespace:System;assembly=System"
xmlns:s2="clr-namespace:System;assembly=mscorlib"
xmlns:s3="clr-namespace:System;assembly=System.Reactive.Core"
xmlns:s4="clr-namespace:System;assembly=System.ComponentModel.Composition"
xmlns:sa="clr-namespace:System.Activities;assembly=System.Activities"
xmlns:sads="http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger"
xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation"
xmlns:sc="clr-namespace:System.Configuration;assembly=System"
xmlns:sc1="clr-namespace:System.Configuration;assembly=System.Configuration"
xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib"
xmlns:sl="clr-namespace:System.Linq;assembly=System.Core"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Sequence sap:VirtualizedContainerService.HintSize="233,206" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces">
<Sequence.Variables>
<Variable x:TypeArguments="x:String" Name="serverName" />
</Sequence.Variables>
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<gwa1:Alert sap:VirtualizedContainerService.HintSize="211,82" Text="[System.Configuration.ConfigurationManager.AppSettings("serverName")]" />
</Sequence>
</Activity>The workflow has been configured in a GE site and a button set up in a SL Viewer to go with it.
The result is an empty alert when it is either run from the Viewer or the Workflow Designer.
Looking forward to hearing any more suggestions. I would certainly expect what you are saying to work but for some reason it is not.
I am wondering if it is related to this issue: https://support.geocortex.com/SupportForums/Thread.aspx?pageid=0&mid=2&ItemID=20&thread=51290
Thanks
Ralph
0 -
Hi Ralph,
I'm not sure what is happening in your case. Your workflow and app settings work correctly for me. Can you make some other change to the config files to confirm that they are actually being loaded?
--Ryan
0 -
Hi Ryan
I can happily make some other changes.
Is there somewhere in the REST Manager that I could get changes to show up or at least be apparent that they have occured?
What .net Framework version have you got installed? Could that make a difference?
Thanks
Ralph
0 -
Hi Ralph,
As a sanity check I would do this...
- Change the Geocortex.Workfow.Designer.exe.config to contain invalid XML (for example, delete the opening <configuration> tag).
- Save it.
- Open Workflow Designer.
- It should crash. If it opens your config file is not being read.
I'm running .NET 4.5, but I doubt this would make a difference. We've used app settings in both 4 amd 4.5.
--Ryan
0 -
Hi Ryan
time to go insane. I get a different view of the file contents depending what I edit it with (NotePad versus Context) on the server as compared to my workstation.
Anyway editing using NotePad as suggested earlier indeed breaks Workflow Designer and the workflow behaves correctly as well.
And I can now get the Annotations working correctly in the Workflow Designer
Thanks for your patience
Regards
Ralph
0
Please sign in to leave a comment.
Comments
7 comments