I have a WCF service in IIS that several .net web applications use. I was commissioned to write a new WCF service with the requirement that existing web applications can use the new service without changing anything except their own web.config.
So, it seems to me that my new service needs two interfaces? I did this, I have three interfaces - ILocationsWCF(the same name as the interface in the old service) ILocationDW(there are new methods) and
ILocationService : ILocationsWCF, ILocationDW.
Then an open class LocationService : ILocationService. I can write a new web application that uses perfectly ILocationService, but I can’t figure out how to make this new service two endpoints, one for old applications and one for new ones (this is done because the old service is a little inconvenient, so I would like to separate them, and then relocate the old applications using the new service, if the opportunity arises). Basically, this change is due to new source data, but I'm distracted.
Here is the error I get:
The binding instance is already associated with a listening URI http://localhost:10737/LocationService.svc. If two endpoints want to use the same ListenUri, they must also use the same instance of the binding object. Two conflicting endpoints were either specified in the AddServiceEndpoint () calls, or in the configuration file, or in combination with AddServiceEndpoint () and configuration.
My attempt to use the web.config service model:
<system.serviceModel>
<services>
<service name="PPS.Services.Location.LocationService" behaviorConfiguration="LocationServiceBehavior">
<endpoint address=""
binding="basicHttpBinding" name="PPS.Services.Location.LocationService"
bindingNamespace="PPS.Services.Location"
contract="PPS.Services.Location.ILocationService"
bindingConfiguration="BasicHttpBinding_ILocationService"
behaviorConfiguration="HttpBehavior">
</endpoint>
<endpoint address=""
binding="basicHttpBinding" name="PPS.Services.Location.LocationsWCF"
bindingNamespace="PPS.Services.Location"
contract="PPS.Services.Location.ILocationsWCF"
bindingConfiguration="BasicHttpBinding_ILocationsWCF"
behaviorConfiguration="HttpBehavior">
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="LocationServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="HttpBehavior" />
</endpointBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ILocationService" receiveTimeout="00:05:00" sendTimeout="00:05:00" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"></binding>
<binding name="BasicHttpBinding_ILocationsWCF" receiveTimeout="00:05:00" sendTimeout="00:05:00" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"></binding>
</basicHttpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
My interfaces:
namespace PPS.Services.Location
{
[ServiceContract(Name = "LocationService")]
public interface ILocationService : ILocationsWCF, ILocationServiceDW
{...
namespace PPS.Services.Location
{
[ServiceContract(Name = "LocationsWCF")]
public interface ILocationsWCF
{...
namespace PPS.Services.Location
{
[ServiceContract(Name = "LocationServiceDW")]
public interface ILocationServiceDW
{...
Any help with these endpoints, or have I gone in the wrong direction?
EDIT - A NEW PROBLEM!
Thanks for the help, marc_s got me out of this hump. Now my goal is to replace the existing service with a new service, changing the endpoint only in web.config. I cannot get this to work, I get an error, for example:
... - ContractFilter EndpointDispatcher...
, , , web.config. ? 2- , ( - ), .
, , 2 , ?
, , .. , , , .
.