This project has moved and is read-only. For the latest updates, please go here.

Invalid operation error while running WCF script

Sep 13, 2012 at 7:50 AM

Hi,

We are using WCF tool to record business flow for our .net (client/server) application. After the script is generated we have modified the endpoint in the InitializationTest() method. When we tried to run it we observed the "System.InvalidOperationException".

If anyone has encountered similar issue kindly help us to resolve it.  Kindly let  me know for more info.


Coordinator
Sep 13, 2012 at 8:07 AM

Unfortunately there is not enough information to be able to assist. Can you share at least the following information:

  1. The stack trace associated with the exception.
  2. The message associated with the exception (if any)

Thanks

Rob

Sep 13, 2012 at 11:03 AM

Thanks for your quick reply Rob.

Pls find the stack trace given below

System.InvalidOperationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error">
<TraceIdentifier>http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.ThrowingException.aspx</TraceIdentifier>
<Description>Throwing an exception.</Description>
<AppDomain>TestAppDomain: 9m8d13e2-6ece-4f3e-9838-4d912d604f77</AppDomain>
<Exception>
<ExceptionType>System.InvalidOperationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b33a4c512334e089</ExceptionType>
<Message>Could not find endpoint element with name 'WSHttpBinding_IMasterService' and contract 'XXX.XX.Service.ISecurity' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this name could be found in the client element.</Message>
<StackTrace>
at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)
at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName, Configuration configuration)
at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName)
at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)
at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName)
at IncidentAdd_002.IncidentAdd_002Tests.InitializeTest()
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct&amp; sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.RunInitializeMethod()
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.ExecuteTest()
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestExecuter.Execute(UnitTestResult result)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestRunner.ExecuteSingleTest(UnitTestExecuter executer, UnitTestElement test, ITestContext testContext, UnitTestAdapterContext userContext, Boolean isLoadTest)
at Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestRunner.Run(UnitTestElement test, ITestContext testContext, Boolean isLoadTest, Boolean useMultipleCpus)
</StackTrace>
<ExceptionString>System.InvalidOperationException: Could not find endpoint element with name 'WSHttpBinding_IMasterService' and contract 'XXX.XX.Service.ISecurity' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this name could be found in the client element.</ExceptionString>
</Exception>

Coordinator
Sep 13, 2012 at 11:27 AM

I think the clue is in the message. Basically you need to make sure that you have a config file in the right location and that the config file and the code agree. This is normal WCF configuration and not really related to the WCF Load Test tool. Try putting the same code in a console application with an app.config file, get it to work there and then transfer the changes you needed to make into the load test.

Regards

Rob