.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Workflow instance id from wsHttpContextBinding vs database InstanceTable.Id

Posted By:      Posted Date: October 03, 2010    Points: 0   Category :Windows Application

I'm working with SqlWorkflowInstanceStore and i'm using wshttpcontextbinding to get workflow instance id for corellation of workflow requests:

IContextManager oContextManager =


string oInstanceId = oContextManager.GetContext()["instanceId"];

but oInstanceId does not map to value of column "Id in System.Activities.DurableInstancing.InstanceTable. Can anyone tell me how to get row of InstanceTable using "instanceId" form IContextManager?


View Complete Post

More Related Resource Links

Activation error occured while trying to get instance of type Database, key "DBName"


Im using Enterprise library 5.0
I have a scenario, where I have to access two different databases in my application.

Basically this application is a webservice,delployed on my local for testing purpose.
I'm trying to access this web method from diffent windows application, default connection works fine but the other database throw's exception.

Problem is only my defaultDatabase is works fine, if I change defaultDatabase="MYCON1" with "MYCON2" it works fine, if I try to access the other database which is not default, throws exception.

<dataConfiguration defaultDatabase="MYCON1" />
<add name="MYCON1" connectionString="Data Source=server1;Initial Catalog=dbName1;User Id=Username1;Password=password1;"

" />
<add name="MYCON2" connectionString="Data Source=Server2;Initial Catalog=dbName2;User Id=Username2;Password=password2;"
providerName="System.Data.SqlClient" />

Database myDB=EnterpriseLibraryContainer.Current.GetInstance<Database>(); --> works fine for the default database (MYCON1)

Database myDB=EnterpriseLibraryCo

Can I dehydrate the Workflow object as well as the instance?

Hiya All Can I dehydrate the workflow object (i.e. not an instanciation of it) into SQLServer?  I want to save all versions created of a workflow so that I can chose to instanciate the workflow from any of the previous versions if I need to. This is due to a compliancy issue - being able to reconstruct the data created by a previous version of a workflow to prove accuracy. ThanksMichelle x

Is there a way to check if workflow instance already exists for a particular productID in Workflow o

I am using Visual Studio 2008 and .NET 3.5. I am trying to build a WF that is exposed as WCF hosted on IIS. This service is consumed by ASP.NET client. It is a very simple WF- receive info for new product "A"- send email to person 'Xyz' that new prodcut "A" is received- do some business process for product "A"- send out more notifications for product "A"Consider this scenario - - Client hits submit on asp.net page for prodcut "A"- new WF instance is created for product "A"- client can go back to the same page, edit some more info and hit save again. However, this time or for any subsequent "Saves",  I do not want to create a new WF instance for product "A".I can check to see if a WF instance exists for product "A" on the client side before calling the service operation. However, I want to see if there is a way to do this in WF or WorkflowServiceHost, as I don't want to add this logic to client. First acitvity in WF has to be receive activity with CanCreateInstance = true, so not sure how I can do this check in WF itself.Also, I have another stupid question, when using WF exposed as WCF service, do we have to implement all service operations using WF? What if I have some service operations that just involves checking some business logic? Do I implement this in a

System.InvalidOperationException: Instance operation is not valid on workflow runtime thread

Am getting the exception related in the title of this article when using the StateMachineWorkflowInstance object to arbitarily set state in my workflow code; and am unsure why.  The code follows below:   500     Protected Overrides Function Execute(ByVal executionContext As System.Workflow.ComponentModel.ActivityExecutionContext) As System.Workflow.ComponentModel.ActivityExecutionStatus   501    502    506         Dim smwi As StateMachineWorkflowInstance = New StateMachineWorkflowInstance(StaticWFRuntime.LocalRuntime, Me.WorkflowInstanceId)   511    512         'set workflow-wide database connection string   513         _connectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString   518    519         Utility.LogEnabled()   520    521         Utility.FoaeaLogger.WriteEntry("Processing TracingApplication.Execute()....", EventLogEntryType.Information)   522         If StaticWFRuntime.LocalRuntime Is Nothing OrElse StaticWFRuntime.LocalRuntime.IsStarted = False Then   523             Utility.FoaeaLogger.WriteEntry("No static RuntimeService object exists!", EventLogEntryType.Warning)   524         End If   525    526         Return MyBase.Execute(executionContext)   527    528     End Function   796     Private Sub gotoState2_ExecuteCode(ByVal sender As System.Object, ByVal e As System.EventArgs)   797    798        

Create new database as a user instance

Hello...Is there any way to create a new database directly as a user instance. I guess this means creating a new mdf/ldf pair which is detached from the server after its created.Thank you...

Workflow Instance ID field in MS Access

Hello, please help! When I open a SP list with MS Access (Action > Open with Access), the Workflow Instance ID field is available with no data.  How can I get this field to display so I can create queries within MS Access using joins/relationships?  Thank you!

"The Database Engine instance you selected is not valid for this edition of Reporting Services" erro

Hi there, I have developed some reports using Visual Studio and everything worked fine in the office. Now I'm trying to deploy them on my customer PCs but this process keeps failing. These reports can be built and even previewed within Visual Studio but they cannot be deployed. Here is the error message I get: ----------------------------------------- The feature: "The Database Engine instance you selected is not valid for this edition of Reporting Services. The Database Engine does not meet edition requirements for report data sources or the report server database." is not supported in this edition of reporting services. ---------------------------------------- The versions of the software on my customer machines are: SQL Server Enterprise 9.0.3282 SQL Server 2005 Management Studio 9.00.4035 SQL Server 2005 Reporting Services Designers 9.00.4035.00 Visual Studio 2005 8.0.50727.42 I believe that changing the edition of the Reporting Services from Designers to Enterprise should fix the deployment error but I did not find a way or setup files to do so. Many thanks in advance for your help!

Create view that amins to tables of another database on the same sql server instance

Hi to everybody, I found a situation ever met before. I develop on Dynamics NAV 5.01 and I have developed a method to be able to see some particular tables of an external database. In substance it deals with a property of tables of Dynamics NAV. When I create a table in NAV, I can create it in 3 different ways: table common to all the companies table  for company or table linked to a view.    This last case is mine, on the same db of NAV I have created a view with some fields, I have created in NAV a table linked with equal fields and types. Until here all normal.    The view, however, aims to another database that doesn't center anything with NAV but that it is on the same intance of SQL server.    The consumer that accesses NAV is a consumer type database SQL Server and has the permitted db_public and db_datareader on both the database. Then he can read the views on the db of nav both on the db of the other database.    When it tries to enter from the console of sql server, with the consumer database, all it works, if I do it by NAV, it show me an error "The server principal "username" is not able to access the database "some_database_name" under the current security context. (Microsoft SQL Server, Error: 916) "    If I add on the database NAV to the consumer, the role db_owner,

Start workflow on database update

HiIs there a way to start a workflow when something in a database has changed (e.g. a row was added)? I am looking for something similar to a Receive activity, but which monitors parts of a database.Could that be achieved by having a "master" workflow that spins off sub-workflows?ThanksAlex

Windows Workflow Persistence Service using Oracle Database



We are using windows state machine workflow. We need to use Oracle for persisteing and tracking workflow instances. Can anyone provide custom services for Oracle?

We have even tried WFTools but not able to connect to Oracle database. Please provide the same code if anyone has tried.





XAML Workflow Definition into SQL database


I have created a workflow using VS 2010 Beta2. Later I have created a table and stored the whole XAML workflow definition into database. My Idea is to invoke the worklfow using the ActivityXAMServices. But I am facing lot of issues. Please let me know wether we can invoke the workflow using the  ActivityXAMServices for the workflow created by VS 2010 beta 2? I am facing lot of issues about the local variales. 

 Please any one can let me know how can I invoke the workflow which is stored in database and later on invoke the workflow through the  ActivityXAMServices or any othre way is there?

Please go through the following code:


string deoXaml = utild.getWorkflowDefinition(workflowName);


Can instance(s) access database(s) not on there instance in sql server


I've only seen instance(s) access databases on that instance. Can multiple instances access databases on other instances, in the old versions or in R2 of sql server?

Object per workflow instance via Extension


I have been trying unsuccessfully to create an extension that will allow me to supply a new instance of a object to each workflow instance.  Specifically, I am attempting to supply a variant of the UnitOfWork class used to managed long running NHibernate ISsessions.  I keep hearing that you can add a service behavior extension on a per-workflow instance basis, but none of the examples I’ve seen show you how.  When I attempt to retrieve the extension in my Activity, I always get the same singleton instance.


public class UnitOfWork : IUnitOfWork


        public Dictionary<string, ISessionFactory&

Why did my workflow execute twice the same instance?



I'd like to understand why is happening this. I'm designing a workflow in SPD, and the same workflow run twice!

Look that "Workflow Completed" is presented twice in the Workflow History.

What is happening? I made some wrong configuration?

I'm trying to update some fields in a list after item update (the workflow A is started after item update), so to avoid loops I created an auxiliary list:

On item update in List A it is started the workflow A that creates an item for each operation in the auxiliary list that starts an workflow B on item creation to update the item in list A...

When the Workflow B tries to update the item, the workflow A is started again, but I added a condition: if there is an item in auxiliary list so this workflow had already executed then the item in auxiliaty list is deleted and worflow stopped. But it didn't stop and it run again as you can see in history:


04/10/2010 08:59 Comment

Get the current workflow instance ID in a WF4 workflow service


Is it possible to somehow query the current workflow instance ID (or another unique identifier) within code executed as part of a workflow service?


public sealed class SomeCodeActivity : CodeActivity
  public InOutArgument<List<string>> Messages { get; set; }

  protected override void Execute(CodeActivityContext context)
    var logger = new SimulatedLogger();

public class SimulatedLogger
  public void CreateLog(IList<string> messages)
    //This line throws an exception

How to resolve this error? - Database on SQL Server instance is not empty and does not match current

Upgrade form MOSS 2007 to Sharepoint 2010.  Reviewing the event log I see the following error.  Not sure what to do and hoping someone can provide some guidance please.

- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
  <Provider Name

SQL 2008 SP2 succefull but instance start fails - Script level upgrade for database 'master' faile


after installing SP2 instance starts and stops with error:

Script level upgrade for database 'master' failed because upgrade step 'sqlagent100_msdb_upgrade.sql' encountered error 5831, state 1, severity 16. This is a serious error condition which might interfere with regular operation and the database will be taken offline. If the error happened during upgrade of the 'master' database, it will prevent the entire SQL Server instance from starting. Examine the previous errorlog entries for errors, take the appropriate corrective actions and re-start the database so that the script upgrade steps run to completion.

Already tried without success:
- enabled SA account (was disabled) http://support.microsoft.com/kb/960781/en-us
- uninstalled SP2 -> other error, but same problems with running the script



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend