Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ASP.net (c#) Webservice calls fail when using ssl site

Posted on 2012-03-22
7
Medium Priority
?
1,343 Views
Last Modified: 2012-03-31
I have built an application that uses a webservice to populate information on jquery dialogs. The application worls well in development and also on a deployment server using http. However, when I use https (which is important), the service call fails. I have read a lot of information about security issues and am lost at what to do. The webservice is a aprt of the application and is being accessed from javascript on the asp.net page:

On the asp.net page:

    <asp:ScriptManager ID="ScriptManager1" runat="server">
        <Services>
        <asp:ServiceReference Path="../services/WorkflowService.svc" />
    </Services>
    </asp:ScriptManager>

I call the service from script using the following:

     var service = new WorkflowService();
       service.ReportAddApproval(reportguid, data, addapprovalSuccess);

when debugging (ie debugger not Visual Studio) on https I get:
       SCRIPT5009: 'WorkflowService' is undefined

I have spent ages trying to resolve this and just cannot see which way to turn. Any help would be greatly appreciated
0
Comment
Question by:spanout
[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
  • 5
  • 2
7 Comments
 
LVL 16

Expert Comment

by:Rose Babu
ID: 37752165
You may encounter an invalid ssl certificate issue.

if so you may bypass the ssl error and continue the process.

Have a look on the below link

http://blog.jameshiggs.com/2008/05/01/c-how-to-accept-an-invalid-ssl-certificate-programmatically/

Hope this may help you.
0
 

Author Comment

by:spanout
ID: 37752206
thanks for this. Do I implement this in the svc file as I am calling it from javascript?

I also not that the document.ready jquery is raining some JS error:

SEC7111: HTTPS security is compromised by (null)
javascript:false;

I cannot see where that is happenning as it is not associated with a script line. All linked js files are references relatively, so should assume the https protocol.
0
 

Author Comment

by:spanout
ID: 37752305
also, the browser doesn't report any certificate problems?
0
2017 Webroot Threat Report

MSPs: Get the facts you need to protect your clients.
The 2017 Webroot Threat Report provides a uniquely insightful global view into the analysis and discoveries made by the Webroot® Threat Intelligence Platform to provide insights on key trends and risks as seen by our users.

 
LVL 16

Expert Comment

by:Rose Babu
ID: 37752408
hi,

my previous comment is for the client side web service call, at that time you can bypass the ssl error if any thrown. you don't want add any code part in your svc service side.

and i try to post the code for the javascript to bypass the ssl error.

also can you check the "View site Information" in the address bar? That may give more info about the ssl.
0
 

Author Comment

by:spanout
ID: 37753966
there appears to be no SSL issues with the site. I use the same certificate for a number of sites without issue. But this is the first site using this webservice. Any javascript code would be appreciated.
0
 

Accepted Solution

by:
spanout earned 0 total points
ID: 37770335
I have managed to answer this myself and here is the solution for anyone experiencing the same issue. The WCF service worked fine when called from javascript over http. As soon as it is moved to https, it fails with javascript error saying service is undefined. It is all to to with the service behaviour. Adding security mode (<security mode="Transport">       </security>) as per the following fixes the issue:

<system.serviceModel>
      <behaviors>
     
                  <serviceBehaviors>
                        <behavior name="metadataAndDebug">
                          <serviceMetadata  httpGetEnabled="true" httpGetUrl=""/>  
                          <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true" />
                        </behavior>
              </serviceBehaviors>
     
                  <endpointBehaviors>
                        <behavior name="XXXXXXXX.Services.WorkflowServiceAspNetAjaxBehavior">
         
                              <enableWebScript/>
                        </behavior>
            </endpointBehaviors>
      </behaviors>
      <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
      <services>
            <service name="XXXXXXXX.Services.WorkflowService">
                  <endpoint address="" behaviorConfiguration="XXXXXXXX.Services.WorkflowServiceAspNetAjaxBehavior" binding="webHttpBinding" bindingConfiguration="webBinding"  contract="XXXXXXXX.Services.WorkflowService"/>
            </service>
      </services>
          <bindings>
                  <webHttpBinding>
                    <binding name="webBinding">
                            <security mode="Transport">       </security>
                    </binding>
                  </webHttpBinding>
          </bindings>
</system.serviceModel>



Thanks to the following excellent blog for clear and concise info on this issue. It is the only place I found anything useful.

http://weblogs.asp.net/srkirkland/archive/2008/02/20/wcf-bindings-needed-for-https.aspx
0
 

Author Closing Comment

by:spanout
ID: 37790559
There was no solution for WCF webservice offered by the experts
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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.
In order to have all security and back ups taken care of, WordPress users can sign up for services with WP Engine.
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

688 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