ASP.NET - Issue with WCF Service in website

Posted on 2012-04-02
Last Modified: 2012-04-03
I developed a WCF Service.  I enter URL HTTPS://myserver/myservice/service.svc and I receive the WSDL.  I then add service reference and the website finds it and adds it successfully.  Running the code the below has no issues.

    ITransferService APILogin = new TransferServiceClient();

However,  when I run the below code

     foreach (var results in APILogin.ILogin(this.txtUserName.Text.ToString(),

I receive the below error

    The provided URI scheme 'https' is invalid; expected 'http'.
    Parameter name: via

I'm using basicHTTPBinding.  Below is what is in my web.config file.

    <binding name="BasicHttpBinding_IMDRTransferService1" closeTimeout="04:01:00"
     openTimeout="04:01:00" receiveTimeout="04:10:00" sendTimeout="04:01:00"
     allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
     maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
     messageEncoding="Text" textEncoding="utf-8" transferMode="StreamedRequest"
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
       maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />

   <endpoint address=""
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITransferService1"
    name="BasicHttpBinding_ITransferService1" />
Question by:CipherIS
LVL 19

Accepted Solution

Rikin Shah earned 167 total points
Comment Utility
LVL 13

Assisted Solution

Ashok earned 167 total points
Comment Utility
The solution is to define a custom binding inside your Web.Config file and set the security mode to "Transport".  Then you just need to use the bindingConfiguration property inside your endpoint definition to point to your custom binding.  The entire HTTPS-enabled system.serviceModel section is below:

see Web.Config here

LVL 20

Assisted Solution

BuggyCoder earned 166 total points
Comment Utility

Author Comment

Comment Utility

Now i'm receiving below error after changing mode = Transport

"There was no endpoint listening at https://myserver/APIFulfillmentHost/Transfer.svc/basic that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details."

Any ideas?  I've dropped the reference and added it again.
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.


Expert Comment

by:Vishal Kedar
Comment Utility
try below URI instead of yours

OLD: https://myserver/APIFulfillmentHost/Transfer.svc/basic

NEW: http://myserver/APIFulfillmentHost/Transfer.svc/basic

for https you need security certificate.

might it helps.

Author Comment

Comment Utility
I have a certificate for https.  I want the service to go over SSL.  If I change it to http then it won't have SSL

Author Comment

Comment Utility
Here is the actual Error:

<E2ETraceEvent xmlns="">
<System xmlns="">
<SubType Name="Error">0</SubType>
<TimeCreated SystemTime="2012-04-03T14:20:10.4252369Z" />
<Source Name="System.ServiceModel" />
<Correlation ActivityID="{ae9918fb-2101-42a1-951b-1b5c16f96bd1}" />
<Execution ProcessName="WebDev.WebServer40" ProcessID="51072" ThreadID="5" />
<Channel />
<TraceRecord xmlns="" Severity="Error">
<Description>Throwing an exception.</Description>
<ExceptionType>System.ServiceModel.EndpointNotFoundException, System.ServiceModel, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>There was no endpoint listening at that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.</Message>
at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type)
at MDRAPIFulfillmentServiceReference.IMDRTransferService.MDRAPILogin(String UserName, String Password)
at MDRAPIFulfillmentServiceReference.MDRTransferServiceClient.MDRAPILogin(String UserName, String Password)
at _Default.cmdLogIn_Click(Object sender, EventArgs e)
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.default_aspx.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously)
at System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(Exception error)
at System.Web.HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
at System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
at System.Web.HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr)
at System.Web.HttpRuntime.ProcessRequest(HttpWorkerRequest wr)
at Microsoft.VisualStudio.WebHost.Request.Process()
at Microsoft.VisualStudio.WebHost.Host.ProcessRequest(Connection conn)
<ExceptionString>System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---&gt; System.Net.WebException: The remote server returned an error: (404) Not Found.
   at System.Net.HttpWebRequest.GetResponse()
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
   --- End of inner exception stack trace ---</ExceptionString>
<ExceptionType>System.Net.WebException, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>The remote server returned an error: (404) Not Found.</Message>
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
<ExceptionString>System.Net.WebException: The remote server returned an error: (404) Not Found.
   at System.Net.HttpWebRequest.GetResponse()
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)</ExceptionString>

Author Closing Comment

Comment Utility
That solved original issue.  Will repost new issue.

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now