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
Solved

SSL WCF Service Issues - Value cannot be null

Posted on 2016-09-21
6
78 Views
Last Modified: 2016-09-21
This is my first time that I’m trying to setup a service to require SSL connections.  The service is accessible but when I try to run one of the methods (Using both WCF Test Client as well as a Web application) I get this error:


Failed to invoke the service. Possible causes: The service is offline or inaccessible; the client-side configuration does not match the proxy; the existing proxy is invalid. Refer to the stack trace for more detail. You can try to recover by starting a new proxy, restoring to default configuration, or refreshing the service.

Value cannot be null.
Parameter name: context

Server stack trace:
   at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at IeSearchServices.GetOrderStatus(String AccountKey, Int32 ItemId)
   at IeSearchServicesClient.GetOrderStatus(String AccountKey, Int32 ItemId)



I’ve tried many of the different “fixes” online with no luck so far.  Any ideas would be appreciated.  Please let me know if additional information would help.

Thanks,
Greg


Server config file information:

<system.serviceModel>

    <services>

        <service name="eSearchServices.eSearchServices">
        <endpoint address=""
                  binding="basicHttpBinding"
                  bindingConfiguration="secureHttpBinding"
                  contract="eSearchServices.IeSearchServices"/>

        <!--<endpoint address="mex"
                  binding="mexHttpsBinding"
                  contract="IMetadataExchange" />-->
          
      </service>

    </services>

    <bindings>

      <basicHttpBinding>
        <binding name="secureHttpBinding">
          <security mode="Transport">
            <transport clientCredentialType="None"/>
          </security>
        </binding>
      </basicHttpBinding>
     

    </bindings>

    <behaviors>
      <serviceBehaviors>
        <behavior>
         <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpsGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    
  </system.serviceModel>

Open in new window

0
Comment
Question by:Greg_L_WER
  • 3
  • 3
6 Comments
 
LVL 35

Accepted Solution

by:
YZlat earned 500 total points
ID: 41809460
try adding behaviorConfguration attribute to your <service> element:

<service name="eSearchServices.eSearchServices" behaviorConfiguration="secureBehavior">

Open in new window


and add a behavior names "secureBehavior" to <behaviors> element. Try something like this:

<behavior name="secureBehavior">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
          <serviceAuthenticationManager authenticationSchemes="Basic"/>
        </behavior>

Open in new window

0
 

Author Comment

by:Greg_L_WER
ID: 41809531
Thanks for the quick reply YZlat!  Unfortunately I'm still getting the same error message...This is the updated config section.  I turned on includeExceptionDetailInFaults to help troubleshoot for now.

Thanks again,
Greg


<system.serviceModel>

    <services>

      <service name="eSearchServices.eSearchServices" behaviorConfiguration="secureBehavior">
        <endpoint address=""
                  binding="basicHttpBinding"
                  bindingConfiguration="secureHttpBinding"
                  contract="eSearchServices.IeSearchServices"/>

      </service>
    </services>

    <bindings>

      <basicHttpBinding>
        <binding name="secureHttpBinding">
          <security mode="Transport">
            <transport clientCredentialType="None"/>
          </security>
        </binding>
      </basicHttpBinding>

    </bindings>

    <behaviors>
      <serviceBehaviors>

        <behavior name="secureBehavior">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <!--<serviceDebug includeExceptionDetailInFaults="false"/>-->
          <serviceAuthenticationManager authenticationSchemes="Basic"/>
        </behavior>

      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    
    
  </system.serviceModel>

Open in new window

0
 

Author Closing Comment

by:Greg_L_WER
ID: 41809652
Thank again YZlat!  Looks like it did work after-all.  Your changes led me to another issue that once I solved it seems to have everything working properly.  One follow-up question for you... how can I check that the information being sent/received from the service is in fact encrypted?

 Thanks,
 Greg
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 35

Expert Comment

by:YZlat
ID: 41809758
What happens if you look at it in fiddler?
0
 
LVL 35

Expert Comment

by:YZlat
ID: 41809762
Also you could try enabling message logging
0
 

Author Comment

by:Greg_L_WER
ID: 41809764
Hmmm... not a program that I've used yet... looks promising.  I'll give it a try.  Thanks for the idea and help earlier :)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

While working on Silverlight and WCF application, I faced one issue where fault exception occurred at WCF operation contract is not getting propagated to Silverlight client. So after searching net I came to know that it was behavior by default for s…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

809 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