Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>404 BadRequest Due to IIS Configuration...</h2> <p>If you are receiving a 404 BadRequest error from IIS after attempting to modify host headers in IIS, this is common, but there is a fix!</p> <h2>Fix By Making IIS Configuration Changes</h2> <p>How can WCF support multiple IIS Binding specified per site?:<BR> <a href="http://tinyurl.com/55q5hg" rel="nofollow noreferrer">http://tinyurl.com/55q5hg</a></p> <h2><strong>Fix By Making WCF Code Modifications</strong></h2> <p>Alternatively, the following article explains how one developer solved this issue with a combination of configuration and code:<BR><BR> <strong>Well, that was fun! An adventure in WCF, SSL, and Host Headers</strong><BR> <a href="http://geekswithblogs.net/rakker/archive/2008/07/03/123562.aspx" rel="nofollow noreferrer">http://geekswithblogs.net/rakker/archive/2008/07/03/123562.aspx</a></p> <p>The article references two important links...</p> <p>The first one explains how to properly set the host headers in IIS:</p> <ul> <li>Configuring Server Bindings for SSL Host Headers (IIS 6.0): <a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/8d9f2a8f-cd23-448c-b2c7-f4e87b9e2d2c.mspx?mfr=true" rel="nofollow noreferrer">http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/8d9f2a8f-cd23-448c-b2c7-f4e87b9e2d2c.mspx?mfr=true</a></li> </ul> <p>After getting host headers working, you'll find that... </p> <blockquote> <p>"you can't have more than one host header for IIS or wcf will break"</p> </blockquote> <p>The solution to working around this limitation is found within this article, and there is also a comment on the GeeksWithBlogs.net article above that provides an enhanced variation:</p> <ul> <li>WCF: This collection already contains an address with scheme http:<br> <a href="http://tinyurl.com/62yssd" rel="nofollow noreferrer">http://tinyurl.com/62yssd</a></li> </ul> <p>If you are still experiencing trouble, let us know in the comments below...</p> <hr> <h2>If the Service is Not Working...</h2> <p>My experience with WCF is that it is very tricky at times, especially with configuration. If one is following best practices and not doing anything non-standard, the great majority of deployment problems are the result of a botched configuration file.</p> <p>In theory (not so much in practice, due to architectural differences), setting up a WCF service on IIS should be no different than setting up a typical virtual directory and corresponding application for web application or for an ASMX web service. </p> <p>Therefore, I recommend that if this is the first WCF service you are exposing to the Internet, follow the same simple approach you would take when exposing your first website. Basically, create a new sample "WCF Service Application" (this is available in the Add New Project dialog, under the Web section of C# or VB). </p> <p>Once you have it working, follow your deployment practices to move it into a production sandbox and test it locally. This sandbox would preferably already have some web sites or web services installed and known to be accessible from the Internet, in order to eliminate any doubt about the typical network configuration issues. If you have a sample ASMX web service that is already successfully exposed on the Internet from that server, that would be best.</p> <p>Next, try testing the the ASMX and the WCF services from web browser, both locally on the server, internally on other desktops and then finally externally. </p> <h2>Testing URLs</h2> <p>We want to test accessing the standard SVC and ASMX file from the web browser in all the varieties of URL flavors that are available and relevant. The results should be similar, with summary page about he service rendering in the window. The difference will be that the ASMX web service's summary will likely allow you to execute the web methods on the service if that feature has not been disabled in the web.config file. </p> <p>Compare the results of browser fetches of the following styles of URLs...</p> <ul> <li>http://<strong>localhost</strong>/WcfService1/Service1.<strong>svc</strong></li> <li>http://<strong>localhost</strong>/WcfService1/Service1.<strong>asmx</strong></li> <li>http://<strong>MachineName or MachineFQN</strong>/WcfService1/Service1.<strong>svc</strong></li> <li>http://<strong>MachineName or MachineFQN</strong>/WcfService1/Service1.<strong>asmx</strong></li> <li>http://<strong>MachineLocalIP#1</strong>/WcfService1/Service1.<strong>svc</strong></li> <li>http://<strong>MachineLocalIP#1</strong>/WcfService1/Service1.<strong>asmx</strong></li> <li>http://<strong>MachineLocalIP#2</strong>/WcfService1/Service1.<strong>svc</strong></li> <li>http://<strong>MachineLocalIP#2</strong>/WcfService1/Service1.<strong>asmx</strong></li> <li>http://<strong>ExternalIP</strong>/WcfService1/Service1.<strong>svc</strong></li> <li>http://<strong>ExternalIP</strong>/WcfService1/Service1.<strong>asmx</strong></li> </ul> <p>All of these tests should return similar results.</p> <h2>Testing Service Methods</h2> <p>If you feel like it, go head and test some web methods on the ASMX web service for any of the tested URLs, from the web browser. You'll soon see that we can test ASMX web services a different way also...</p> <p>Next we'll test web methods on both the WCF service and the ASMX web service by using the <strong>WcfTestClient.exe</strong> application that is found in the Visual Studio 2008 distribution (<strong>C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE</strong>). </p> <p>You will need to add the services through the <strong>File->Add Service menu item</strong>, typing in the URL above for each service URL that you wish to test. Make sure to include the filename of the SVC and ASMX files. If all is well, the MEX endpoint that is enabled by the "httpGetEnabled" attribute of the <code>&lt;serviceMetadata/&gt;</code> element in the web.config file will return the data that is necessary for the utility to operate, thereby populating the tree with the inventory of our service methods like this:</p> <p><img src="https://i.stack.imgur.com/mNK8l.jpg" alt="http://i.stack.imgur.com/mNK8l.jpg"></p> <p>From this point, it will be useful to refer to the following to resources:</p> <ul> <li>WCFTestClient: <a href="http://msdn.microsoft.com/en-us/library/bb552364.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/bb552364.aspx</a></li> <li>What's New for WCF in Visual Studio 2008: <a href="http://msdn.microsoft.com/en-us/magazine/cc163289.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/magazine/cc163289.aspx</a></li> </ul> <h2>Conclusion</h2> <p>If you make it this far, then I do not expect any other issues and you should now attempt to compare the setup of the samples to the WCF service that you are attempting to publish to the Internet, and hopefully the differences will be obvious. </p> <p>Remember to treat the WCF service like an ASMX web service during you diagnostics, assuming that the web.config is known to be set up correctly.</p> <p>If you are still unable to make things work, check this guide for further technical advice: </p> <ul> <li>Deploying an IIS-hosted WCF service: <a href="http://msdn.microsoft.com/en-us/library/aa751792.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa751792.aspx</a></li> </ul> <p>Finally, if all else fails, just wrap your WCF service in an ASMX web service:</p> <ul> <li>How to: Expose WCF service also as ASMX web-service: <a href="http://kjellsj.blogspot.com/2006/12/how-to-expose-wcf-service-also-as-asmx.html" rel="nofollow noreferrer">http://kjellsj.blogspot.com/2006/12/how-to-expose-wcf-service-also-as-asmx.html</a></li> </ul>
    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