Quantcast
Channel: Configuration & Scripting
Viewing all articles
Browse latest Browse all 780

HTTPS Rewrite rule causing 404 error for WCF Service

$
0
0

I've published WCF services to my domain

When I try to add Service References in project from Visual Studio by specifying say: http://domain.com/MyService.svc link.

It gives 404 error with following details:

There was an error downloading 'http://domain.com/MyService.svc/_vti_bin/ListData.svc/$metadata'.</div><div>The request failed with HTTP status 404: Not Found.</div> <div>Metadata contains a reference that cannot be resolved: 'http://domain.com/MyService.svc'.</div> <div>The content type text/html; charset=UTF-8 of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '<HTML><HEAD><link rel="alternate" type="text/xml" href="http://domain.com/MyService.svc?disco"/><STYLE type="text/css">#content{ FONT-SIZE: 0.7em; PADDING-BOTTOM: 2em; MARGIN-LEFT: 30px}BODY{MARGIN-TOP: 0px; MARGIN-LEFT: 0px; COLOR: #000000; FONT-FAMILY: Verdana; BACKGROUND-COLOR: white}P{MARGIN-TOP: 0px; MARGIN-BOTTOM: 12px; COLOR: #000000; FONT-FAMILY: Verdana}PRE{BORDER-RIGHT: #f0f0e0 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #f0f0e0 1px solid; MARGIN-TOP: -5px; PADDING-LEFT: 5px; FONT-SIZE: 1.2em; PADDING-BOTTOM: 5px; BORDER-LEFT: #f0f0e0 1px solid; PADDING-TOP: 5px; BORDER-BOTTOM: #f0f0e0 1px solid; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e5e5cc}.heading1{MARGIN-TOP: 0px; PADDING-LEFT: 15px; FONT-WEIGHT: normal; FONT-SIZE: 26px; MARGIN-BOTTOM: 0px; PADDING-BOTTOM: 3px; MARGIN-LEFT: -30px; WIDTH: 100%; COLOR: #ffffff; PADDING-TOP: 10px; FONT-FAMILY: Tahoma; BACKGROUND-COLOR: #003366}.intro{MARGIN-LEFT: -15px}</STYLE><TITLE>DonorService Service</TITLE></HEAD><BODY><DIV id="content"><P class="head'. If the service is defined in the current solution, try building the solution and adding the service reference again.

Ironically, same path, either with http or https, in the browser redirects us to service definition without fail.

This all happens when I've mentioned https rewrite rule in Web.config:

<rewrite><rules><clear /><rule name="Redirect to https" stopProcessing="true"><match url="(.*)" /><conditions><add input="{HTTPS}" pattern="off" ignoreCase="true" /></conditions><action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" /></rule></rules></rewrite>

When I remove this rule from web.config, then I can add service reference in Visual Studio without any problem.

Please let me know where is the mistake.

Any suggestions would be the great help! 


Viewing all articles
Browse latest Browse all 780

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>