Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two servers A and B,with the same deploy package.
A works well.
B throw an error:
XML
<Message>The given key was not present in the dictionary.</Message>
            <StackTrace>at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at webservice1.InvokeBusinessWorkflow[TWorkflow,TRQ,TRS](TRQ request)
at webservice1.ProcessOneStepCal(ProcessOneStepCalSoapIn request)
at SyncInvokeProcessOneStepCal(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]&amp; outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc&amp; rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</StackTrace>
            <Type>System.Collections.Generic.KeyNotFoundException</Type>


I toally have no idea how this could happen.(the web service solution used to be updated from 2008 to 2010).
Could anybody help?

Sorry,I didn't claim the context clear.
In my solution,I start a workflow like this:

XML
private TRS InvokeBusinessWorkflow<TWorkflow, TRQ, TRS>(TRQ request)
       {
           TRS response;

           #region Workflow implementation
           // Build the parameters for the Workflow
           Dictionary<string, object> inputParameters = new Dictionary<string, object>();
           Dictionary<string, object> outputParameters = new Dictionary<string, object>();
           inputParameters.Add(typeof(TRQ).Name, request);

           // Execute the Workflow
           HostWorkflowService.StartWorkflow(typeof(TWorkflow), inputParameters, outputParameters);
           // Build the response based on the parameters.
           response = (TRS)outputParameters[typeof(TRS).Name];
           #endregion

           return response;
       }


It works well host by IIS6 in server A(I can get what I want).
but throw exception in server B(the deloyed files are 100% the same).
unfortunately, the server B is important to me and this dirves me crasy.
Posted
Updated 15-Dec-10 1:33am
v3
Comments
Dave Kreskowiak 15-Dec-10 0:44am    
Seems simple enough. Your code tried to access a Key/value pair collection using a key that didn't exist in the Keys portion of the collection. What's not to understand?

1 solution

Your exception must be thrown at this line

response = (TRS)outputParameters[typeof(TRS).Name];


For some reason, it's not finding your TRS object in the outputParameters dictionary

Can't really advise more without knowing how HostWorkflowService.StartWorkflow populates the dictionary
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900