I have created a WCF service and Web.Config file has below settings.
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" sendTimeout="10:00:00" openTimeout="10:00:00">
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="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="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="Axis.OptimizationService.RMSCalculationService">
<endpoint address="" binding="basicHttpBinding" contract="Axis.RMS.Optimization.Contracts.IRMSCalculationService"></endpoint>
</service>
</services>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" minFreeMemoryPercentageToActivateService="0"/>
In my ClassLibrary project, I have created Servcie reference with the name CatpricingService and the app.config file looks as below.
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IRMSCalculationService" closeTimeout="00:30:00"
openTimeout="00:30:00" receiveTimeout="00:30:00" sendTimeout="01:00:00"
maxBufferPoolSize="0" maxReceivedMessageSize="2147483647"
useDefaultWebProxy="true" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:2200/RMSCalculationService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IRMSCalculationService"
contract="CatPricingService.IRMSCalculationService" name="BasicHttpBinding_IRMSCalculationService" />
</client>
I am not sure what I am doing wrong here. I did this several times. I could not figure out what the error is. To me all settings seems correct. I am getting this error.
Could not find default endpoint element that references contract 'CatPricingService.IRMSCalculationService' 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.
I referred other questions on Stackoverflow..... i m going nuts with this. Can anyone figure out what is wrong with my settings?
Here my ClassLibrary project is running with external program excel.exe. (Project properties, Debug tab, selected "Start external program" and gave value as C:\Program Files\Microsoft Office\Office14\EXCEL.EXE
Thanks
You need to move the configuration from
app.config
in yourClassLibrary
project to theapp.config
of the main project (for example, an WPF application). Probably it is the project which references yourClassLibrary
.Only
app.config
in the main project will be used when your program executes.Updated:
In this case, I think you need to create client class programmatically, do not depend on
app.config
, something like this: