Note that there are some explanatory texts on larger screens.

plurals
  1. POCombine old WCF service with new WCF service Almost There
    primarykey
    data
    text
    <p>I have a WCF service on IIS that a few .net web applications are using. I was tasked with writing a new WCF service, with the requirement that the existing web apps could use the new service without changing anything but their <code>web.config</code>.</p> <p>So my new service needs 2 interfaces, I think? I've done that, I have three interfaces - <code>ILocationsWCF</code> (same name as the interface in the old service) <code>ILocationDW</code> (has new methods) and </p> <pre><code>ILocationService : ILocationsWCF, ILocationDW. </code></pre> <p>Then public class <code>LocationService : ILocationService</code>. I can write a new web app that uses <code>ILocationService</code> just fine - but I can't figure out how to make this new service have 2 endpoints, one for the old apps and one for the new ones (doing this because the old service is a bit awkward so I would like to keep them separated, then redeploy the old apps with the new service if the opportunity arises). Mostly, this change is driven by new source data - but I digress.</p> <p>Here is the error I get:</p> <blockquote> <p>A binding instance has already been associated to listen URI <code>http://localhost:10737/LocationService.svc</code>. If two endpoints want to share the same ListenUri, they must also share the same binding object instance. The two conflicting endpoints were either specified in AddServiceEndpoint() calls, in a config file, or a combination of AddServiceEndpoint() and config. </p> </blockquote> <p>My attempt at web.config service model:</p> <pre><code> &lt;system.serviceModel&gt; &lt;services&gt; &lt;service name="PPS.Services.Location.LocationService" behaviorConfiguration="LocationServiceBehavior"&gt; &lt;endpoint address="" binding="basicHttpBinding" name="PPS.Services.Location.LocationService" bindingNamespace="PPS.Services.Location" contract="PPS.Services.Location.ILocationService" bindingConfiguration="BasicHttpBinding_ILocationService" behaviorConfiguration="HttpBehavior"&gt; &lt;/endpoint&gt; &lt;endpoint address="" binding="basicHttpBinding" name="PPS.Services.Location.LocationsWCF" bindingNamespace="PPS.Services.Location" contract="PPS.Services.Location.ILocationsWCF" bindingConfiguration="BasicHttpBinding_ILocationsWCF" behaviorConfiguration="HttpBehavior"&gt; &lt;/endpoint&gt; &lt;/service&gt; &lt;/services&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior name="LocationServiceBehavior"&gt; &lt;!-- To avoid disclosing metadata information, set the values below to false before deployment --&gt; &lt;serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" /&gt; &lt;!-- 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 --&gt; &lt;serviceDebug includeExceptionDetailInFaults="true" /&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;endpointBehaviors&gt; &lt;behavior name="HttpBehavior" /&gt; &lt;/endpointBehaviors&gt; &lt;/behaviors&gt; &lt;bindings&gt; &lt;basicHttpBinding&gt; &lt;binding name="BasicHttpBinding_ILocationService" receiveTimeout="00:05:00" sendTimeout="00:05:00" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"&gt;&lt;/binding&gt; &lt;binding name="BasicHttpBinding_ILocationsWCF" receiveTimeout="00:05:00" sendTimeout="00:05:00" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"&gt;&lt;/binding&gt; &lt;/basicHttpBinding&gt; &lt;/bindings&gt; &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /&gt; </code></pre> <p></p> <p>My Interfaces:</p> <pre><code>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 {... </code></pre> <p>Any help with these endpoints, or have I gone off in the wrong direction?</p> <p>EDIT -- NEW PROBLEM!</p> <p>Thanks for the help, marc_s got me over that hump. Now, my goal is to replace the existing service with the new service, by changing the endpoint in web.config only. I cannot get this to work, I get the error like:</p> <p><strong>...cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher...</strong> </p> <p>If I remove the old service from the application and replace it with the new one, then compile and run it works - but I don't want to have to re-deploy all my old apps, I would rather just replace the endpoint in the web.config. Can I even do this? There are differences in the 2 services, mainly a new database (our student data is now with a new vendor -- out of my control) plus I've learned a lot and was able to write a much better service. Can I do what I want here, or will I need to run 2 services until I can move all the old apps to the new service? Note, when I'm certain the contracts etc are identical, but if you need to see files just let me know which ones. thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload