none
Problem consuming WCF service

    Question

  • Hi There,

     

    am a newbie to LoadTest . and using VSTS 2008 RTM , i have load test configured for 5 virtual users and for 5 Iteration.

    the test runs wonderfully some times and most of the times  will have this error message thrown :

    Test method Test_CreateXXX threw exception:  System.InvalidOperationException: Could not find default endpoint element that references contract 'ServiceReference.IService' 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 contract could be found in the client element..

     

    could any body help me out of this.

     

    i guess this is not specific to VSTS test ,so the i posted this question here.

     

    Thanks In Advance

     

    Regards

    Deepak

    Friday, November 30, 2007 12:51 AM

Answers

All replies

  • Can you describe the scenario a bit more?  Assuming you have a WCF app with client and server, are you using a config file for the client?  If so, can you post it?

     

    -James

    Friday, November 30, 2007 9:52 PM
    Moderator
  • Hi James ,

     

    Thanks for the response , i can't post the production ones ,but i can reproduce the same problem using with the default service contracts by VS 2008 WCF service template

    These are my contracts

    [ServiceContract]

    public interface IService1

    {

    [OperationContract]

    string GetData(int value);

    [OperationContract]

    CompositeType GetDataUsingDataContract(CompositeType composite);

     

    }

     

    // Use a data contract as illustrated in the sample below to add composite types to service operations.

    [DataContract]

    public class CompositeType

    {

    bool boolValue = true;

    string stringValue = "Hello ";

    [DataMember]

    public bool BoolValue

    {

    get { return boolValue; }

    set { boolValue = value; }

    }

    [DataMember]

    public string StringValue

    {

    get { return stringValue; }

    set { stringValue = value; }

    }

    }

     

    WebConfig of service

     

    <?xml version="1.0"?>

    <!--

    Note: As an alternative to hand editing this file you can use the

    web admin tool to configure settings for your application. Use

    the Website->Asp.Net Configuration option in Visual Studio.

    A full list of settings and comments can be found in

    machine.config.comments usually located in

    \Windows\Microsoft.Net\Framework\v2.x\Config

    -->

    <configuration>

    <configSections>

    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

    <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

    <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

    <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

    <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>

    <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

    <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

    <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

    </sectionGroup>

    </sectionGroup>

    </sectionGroup>

    </configSections>

    <appSettings/>

    <connectionStrings/>

    <system.web>

    <!--

    Set compilation debug="true" to insert debugging

    symbols into the compiled page. Because this

    affects performance, set this value to true only

    during development.

    -->

    <compilation debug="true">

    <assemblies>

    <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

    <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    </assemblies>

    </compilation>

    <!--

    The <authentication> section enables configuration

    of the security authentication mode used by

    ASP.NET to identify an incoming user.

    -->

    <authentication mode="Windows"/>

    <!--

    The <customErrors> section enables configuration

    of what to do if/when an unhandled error occurs

    during the execution of a request. Specifically,

    it enables developers to configure html error pages

    to be displayed in place of a error stack trace.

    <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">

    <error statusCode="403" redirect="NoAccess.htm" />

    <error statusCode="404" redirect="FileNotFound.htm" />

    </customErrors>

    -->

    <pages>

    <controls>

    <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    </controls>

    </pages>

    <httpHandlers>

    <remove verb="*" path="*.asmx"/>

    <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>

    </httpHandlers>

    <httpModules>

    <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    </httpModules>

    </system.web>

    <system.codedom>

    <compilers>

    <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

    <providerOption name="CompilerVersion" value="v3.5"/>

    <providerOption name="WarnAsError" value="false"/>

    </compiler>

    </compilers>

    </system.codedom>

    <!--

    The system.webServer section is required for running ASP.NET AJAX under Internet

    Information Services 7.0. It is not necessary for previous version of IIS.

    -->

    <system.webServer>

    <validation validateIntegratedModeConfiguration="false"/>

    <modules>

    <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    </modules>

    <handlers>

    <remove name="WebServiceHandlerFactory-Integrated"/>

    <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    </handlers>

    </system.webServer>

    <system.serviceModel>

    <bindings />

    <client />

    <services>

    <service name="WcfService2.Service1" behaviorConfiguration="WcfService2.Service1Behavior">

    <!-- Service Endpoints -->

    <endpoint address="" binding="wsHttpBinding" contract="WcfService2.IService1">

    <!--

    Upon deployment, the following identity element should be removed or replaced to reflect the

    identity under which the deployed service runs. If removed, WCF will infer an appropriate identity

    automatically.

    -->

    <identity>

    <dns value="localhost"/>

    </identity>

    </endpoint>

    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>

    </service>

    </services>

    <behaviors>

    <serviceBehaviors>

    <behavior name="WcfService2.Service1Behavior">

    <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->

    <serviceMetadata httpGetEnabled="true"/>

    <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->

    <serviceDebug includeExceptionDetailInFaults="false"/>

    </behavior>

    </serviceBehaviors>

    </behaviors>

    </system.serviceModel>

    </configuration>

     

    and the client config is :

     

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

    <configuration>

    <system.serviceModel>

    <bindings>

    <wsHttpBinding>

    <binding name="WSHttpBinding_IService1" closeTimeout="00:01:00"

    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"

    bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"

    maxBufferPoolSize="524288" maxReceivedMessageSize="65536"

    messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"

    allowCookies="false">

    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"

    maxBytesPerRead="4096" maxNameTableCharCount="16384" />

    <reliableSession ordered="true" inactivityTimeout="00:10:00"

    enabled="false" />

    <security mode="Message">

    <transport clientCredentialType="Windows" proxyCredentialType="None"

    realm="" />

    <message clientCredentialType="Windows" negotiateServiceCredential="true"

    algorithmSuite="Default" establishSecurityContext="true" />

    </security>

    </binding>

    </wsHttpBinding>

    </bindings>

    <client>

    <endpoint address="http://bvtnd-sasdev01.am.thmulti.com/WcfService2/Service1.svc"

    binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService1"

    contract="ServiceReference1.IService1" name="WSHttpBinding_IService1">

    <identity>

    <dns value="localhost" />

    </identity>

    </endpoint>

    </client>

    </system.serviceModel>

    </configuration>

     

    and i am using the default devepement server. i think all my namespaces are correct.

     

    Regards

    Deepak

     

    Friday, November 30, 2007 10:55 PM
  • Adding ;

     

    some times the test goes through ,and most of the time it does not ,so wa thinking is there are any race condtion within the Test context 

    Friday, November 30, 2007 11:04 PM
  • I don't see ServiceReference1.IService1 in your service config.

     

    -James

    Saturday, December 01, 2007 12:33 AM
    Moderator
  •  

    Hi James,

     

    The contract is WcfService2.IService1 ,  in VS when we are adding the Service Reference , The auto generated proxy and client app.config will contain the name given to the service reference (ex: ServiceReference1.IService1) .so when we look into the Configuration.svcinfo i found this bit

    "  contractName="ServiceReference1.IService1" originalName="WSHttpBinding_IService1"  "

    which is probably aliasing stuff.

     

    so ,guess  ServiceReference1.IService1  not in  service config should not be a problem .

     

    one more behaviour i could quote is ,some times the test passes and most of the times it fails, does this has anything to do with Warm up Duration or Cool down Duration , am a newbie using VSTS load tests ,so do not eastly know wht affects the Testcontext behaviour.

     

    one more thing to add is the unit test is passing every time( this is the same unit test included in the load test)

     

    Hope am clear.

     

    Regards

    Deepak

    Saturday, December 01, 2007 12:58 AM
  • Friday, December 14, 2007 10:29 PM
  • if you are using svcutil-generated configuration file and proxy class, please copy 

    <system.serviceModel>
    ----------------------

     </system.serviceModel>

    to your application's configuration file.


    • Edited by Roshe Saturday, April 21, 2012 11:49 AM typo
    Saturday, April 21, 2012 10:03 AM