title: Changing schemaLocation in WSDL
body: <p>I have a WCF Service which I need to host on an old IIS 6 server. The server has a name Server1 but also has an alias used for the website. Apparently the server and the website resolve to different IP addresses. </p>
  
  <p>So WCF Service path is</p>
  
  <blockquote>
    <p><a href="https://alias.sys.domain.com/ProjectName/MyService.svc?wsdl" rel="nofollow">https://alias.sys.domain.com/ProjectName/MyService.svc?wsdl</a></p>
  </blockquote>
  
  <p>But when I look at xml generates, the <code>schemaLocation</code> shows up as:</p>
  
  <pre><code>&lt;wsdl:types&gt;
    &lt;xsd:schema targetNamespace="http://tempuri.org/Imports"&gt;
       &lt;xsd:import schemaLocation="https://server1.subdomain.domain.com/ProjectName/MyService.svc?xsd=xsd0" namespace="http://tempuri.org/" /&gt; 
       &lt;xsd:import schemaLocation="https://server1.subdomain.domain.com/ProjectName/MyService.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/ProjectName" /&gt; 
       &lt;xsd:import schemaLocation="https://server1.subdomain.domain.com/ProjectName/MyService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" /&gt; 
     &lt;/xsd:schema&gt;
  &lt;/wsdl:types&gt;
  </code></pre>
  
  <p>If I try accessing the schema specified in the xml </p>
  
  <blockquote>
    <p><a href="https://server1.subdomain.domain.com/ProjectName/MyService.svc?xsd=xsd0" rel="nofollow">https://server1.subdomain.domain.com/ProjectName/MyService.svc?xsd=xsd0</a></p>
  </blockquote>
  
  <p>I get "Page cannot be displayed" error, and if I use Network tab in Chrome debug tools, it shows the call has been aborted. But if I try accessing the schema at</p>
  
  <blockquote>
    <p><a href="https://alias.sys.domain.com/ProjectName/MyService.svc?xsd=xsd0" rel="nofollow">https://alias.sys.domain.com/ProjectName/MyService.svc?xsd=xsd0</a></p>
  </blockquote>
  
  <p>Then I can get to it without a problem but, unfortunately this is not the one used by the service. </p>
  
  <p>To change that I added httpsGetURL in my config file:</p>
  
  <pre><code>&lt;serviceMetadata httpGetEnabled="true" httpsGetUrl="https://alias.sys.domain.com/ProjectName/MyService.svc"  /&gt;
  </code></pre>
  
  <p>that caused error: </p>
  
  <blockquote>
    <p>A registration already exists for URI</p>
  </blockquote>
  
  <p>which I was able to get rid of by adding <code>/mex</code> after <code>.svc</code>. The strange thing is that I do not have <code>mex</code> endpoint since I cannot use it due to disabled anonymous authentication.</p>
  
  <p>But adding <code>/mex</code> caused another error </p>
  
  <blockquote>
    <p>The message with To '<a href="https://alias.sys.domain.com/ProjectName/MyService.svc/mex?wsdl" rel="nofollow">https://alias.sys.domain.com/ProjectName/MyService.svc/mex?wsdl</a>' 
    cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. 
    Check that the sender and receiver's EndpointAddresses agree.</p>
  </blockquote>
  
  <p>So then I added address to my endpoint, changing it from</p>
  
  <pre><code>&lt;endpoint address="" binding="webHttpBinding" bindingConfiguration="webBinding" contract="Projectname.IMyService"/&gt;
  </code></pre>
  
  <p>to</p>
  
  <pre><code>&lt;endpoint address="web1" binding="webHttpBinding" bindingConfiguration="webBinding" contract="Projectname.IMyService"/&gt;
  </code></pre>
  
  <p>and tried using </p>
  
  <blockquote>
    <p><a href="https://alias.sys.domain.com/ProjectName/MyService.svc/web1" rel="nofollow">https://alias.sys.domain.com/ProjectName/MyService.svc/web1</a></p>
  </blockquote>
  
  <p>that changed my error to</p>
  
  <blockquote>
    <p>The message with Action '' cannot be processed at the receiver, due to a ContractFilter 
    mismatch at the EndpointDispatcher. This may be because of either a contract mismatch 
    (mismatched Actions between sender and receiver) or a binding/security mismatch between 
    the sender and the receiver. Check that sender and receiver have the same contract and 
    the same binding (including security requirements, e.g. Message, Transport, None)
    [/code]</p>
  </blockquote>
  
  <p>Can anyone help?</p>
  
  <pre><code>&lt;system.serviceModel&gt;
  &lt;bindings&gt;
    &lt;basicHttpBinding&gt;
      &lt;binding name="basicHTTP"&gt;
        &lt;security mode="TransportCredentialOnly"&gt;
          &lt;transport clientCredentialType="Windows"&gt;
          &lt;/transport&gt;
        &lt;/security&gt;
      &lt;/binding&gt;
    &lt;/basicHttpBinding&gt;
    &lt;webHttpBinding&gt;
      &lt;binding name="webBinding"&gt;
        &lt;security mode="Transport"&gt;
        &lt;transport clientCredentialType="Windows"&gt;
          &lt;/transport&gt;
        &lt;/security&gt;
     &lt;/binding&gt;
    &lt;/webHttpBinding&gt;
  &lt;/bindings&gt;
  &lt;services&gt;
    &lt;service behaviorConfiguration="basicBehavior" name="ProjectName.MyService"&gt;
  &lt;endpoint address="" binding="webHttpBinding" bindingConfiguration="webBinding" contract="Projectname.IMyService"/&gt;
      &lt;!--&lt;endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" /&gt;--&gt;
    &lt;/service&gt;
  &lt;/services&gt;
  &lt;behaviors&gt;
    &lt;serviceBehaviors&gt;
      &lt;behavior name="basicBehavior"&gt;
        &lt;serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"/&gt;
        &lt;serviceDebug includeExceptionDetailInFaults="true"/&gt;
        &lt;serviceCredentials&gt;
            &lt;windowsAuthentication includeWindowsGroups="true" allowAnonymousLogons="false"&gt;
           &lt;/windowsAuthentication&gt;
      &lt;/serviceCredentials&gt;--&gt;
      &lt;/behavior&gt;
    &lt;/serviceBehaviors&gt;
  &lt;/behaviors&gt;
  &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="false"/&gt;
  &lt;/system.serviceModel&gt;
  </code></pre>
  
  <p>and here is the interface:</p>
  
  <pre><code>public interface IMyService
  {
  
      [OperationContract]
      [WebInvoke(UriTemplate = "GetStatus/{groupID}/{groupName}", Method = "GET",
        ResponseFormat = WebMessageFormat.Json,
        RequestFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.WrappedRequest)]
      string GetStatus(string groupID, string groupName);
  
  }
  </code></pre>