Solved

ASP.NET - Issue with WCF Service in website

Posted on 2012-04-02
8
1,278 Views
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(),
                                                                        this.txtPassword.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"
     useDefaultWebProxy="true">
      <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
       maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />


   <endpoint address="https://api.myserver.net/APIFulfillmentHost/Transfer.svc/basic"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITransferService1"
    contract="APIFulfillmentServiceReference.ITransferService"
    name="BasicHttpBinding_ITransferService1" />
0
Comment
Question by:CipherIS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 19

Accepted Solution

by:
Rikin Shah earned 167 total points
ID: 37797511
0
 
LVL 13

Assisted Solution

by:Ashok
Ashok earned 167 total points
ID: 37797521
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
http://weblogs.asp.net/srkirkland/archive/2008/02/20/wcf-bindings-needed-for-https.aspx

HTH
Ashok
0
 
LVL 20

Assisted Solution

by:BuggyCoder
BuggyCoder earned 166 total points
ID: 37797559
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
LVL 1

Author Comment

by:CipherIS
ID: 37799022
Thanks

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.
0
 
LVL 5

Expert Comment

by:Vishal Kedar
ID: 37800265
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.
0
 
LVL 1

Author Comment

by:CipherIS
ID: 37801082
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
0
 
LVL 1

Author Comment

by:CipherIS
ID: 37801351
Here is the actual Error:


<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>131075</EventID>
<Type>3</Type>
<SubType Name="Error">0</SubType>
<Level>2</Level>
<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 />
<Computer>CV20</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error">
<TraceIdentifier>http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.ThrowingException.aspx</TraceIdentifier>
<Description>Throwing an exception.</Description>
<AppDomain>e92ab581-1-129779363730394987</AppDomain>
<Exception>
<ExceptionType>System.ServiceModel.EndpointNotFoundException, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>There was no endpoint listening at https://www.myorders.net/APIFulfillmentHost/MDRTransfer.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.</Message>
<StackTrace>
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)
</StackTrace>
<ExceptionString>System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at https://www.myorders.net/APIFulfillmentHost/MDRTransfer.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. ---&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>
<InnerException>
<ExceptionType>System.Net.WebException, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>The remote server returned an error: (404) Not Found.</Message>
<StackTrace>
at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
</StackTrace>
<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>
</InnerException>
</Exception>
</TraceRecord>
</DataItem>
</TraceData>
</ApplicationData>
</E2ETraceEvent>
0
 
LVL 1

Author Closing Comment

by:CipherIS
ID: 37801359
That solved original issue.  Will repost new issue.
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

726 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