Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>OK, so the most important things are:</p> <ul> <li>address</li> <li>binding</li> <li>contract </li> </ul> <p>and then some additional stuff thrown in.</p> <p>1) Address:</p> <p>Get this from here:</p> <pre><code>WebServiceHost host = new WebServiceHost( typeof(MyService), new Uri("http://localhost:80/")); host.AddServiceEndpoint(typeof(MyService), new WebHttpBinding(), ""); </code></pre> <p>and here:</p> <pre><code>ServiceEndpoint sbEndpoint = host.AddServiceEndpoint( typeof(MyService), new WebHttpRelayBinding(), "http://azureURL"); </code></pre> <p>so you'll need something like:</p> <pre><code>&lt;endpoint address="" &lt;endpoint address="http://azureURL" &lt;endpoint address=""http://someURL" </code></pre> <p>in your service.</p> <p>2) Binding:</p> <p>The first endpoint is a webHttpBinding, the second one uses a custom binding ("MyBinding") - so you have:</p> <pre><code>&lt;endpoint address="" binding="webHttpBinding" &lt;endpoint address="http://azureURL" binding="webRelayHttpBinding" &lt;endpoint address=""http://someURL" binding="myBinding" </code></pre> <p>and you'll need to define your custom binding:</p> <pre><code>&lt;bindings&gt; &lt;customBinding&gt; &lt;binding name="MyBinding"&gt; .. define the parameters of your binding here &lt;/binding&gt; &lt;/customBinding&gt; &lt;/bindings&gt; </code></pre> <p>or create a <code>&lt;extensions&gt;</code> section for your binding stored in code in a separate assembly.</p> <p>3) Contracts</p> <p>I don't clearly see a contract anywhere - you only ever use the typeof(MyService), but usually, this is the concrete service <strong>instance</strong>, not the service <strong>contract</strong> which should be an interface (something like <code>IMyService</code>). Why don't you have an explicit service contract?</p> <p>Anyway, if your service implementation is the contract, too, at the same time (not best practice! but possible), then you have your two endpoints like this:</p> <pre><code>&lt;endpoint address="" binding="webHttpBinding" contract="MyService" /&gt; &lt;endpoint address="http://azureURL" binding="webHttpRelayBinding" contract="MyService" /&gt; &lt;endpoint address="http://someURL" binding="myBinding" contract="MyService" /&gt; </code></pre> <p>You then need to add a few sprinkles here and there (define the "base address" of the service, give the service a name and so on), and should end up with something like:</p> <pre><code>&lt;system.serviceModel&gt; &lt;bindings&gt; &lt;customBinding&gt; &lt;binding name="MyBinding"&gt; .. define the parameters of your binding here &lt;/binding&gt; &lt;/customBinding&gt; &lt;/bindings&gt; &lt;services&gt; &lt;service name="YourNameSpace.MyService"&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress="http://localhost:80/" /&gt; &lt;/baseAddresses&gt; &lt;/host&gt; &lt;endpoint address="" binding="webHttpBinding" contract="MyService" /&gt; &lt;endpoint address="http://azureURL" binding="webHttpRelayBinding" contract="MyService" /&gt; &lt;endpoint address="http://someURL" binding="myBinding" contract="MyService" /&gt; &lt;/service&gt; &lt;/services&gt; &lt;/system.serviceModel&gt; </code></pre> <p>Now all you're missing is the behavior defined - I'll leave that as an exercise for the poster :-)</p> <p>Does that help anything?</p> <p>As for references - hmmm..... hard to say.... I guess the usual books ("Learning WCF" by M.L.Bustamante for beginner/intermediate, "Programming WCF" by Juval Lowy for intermediate/advanced) are my best bet, and lots of experience, really. I don't know of any source that explicitly shows and teaches how to convert between settings in code and config - the two books mentioned usually show both ways, and from this, you can figure it out yourself.</p> <p>Marc</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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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