Showing posts with label Web Services. Show all posts
Showing posts with label Web Services. Show all posts

Saturday, April 16, 2011

Ajax SVC getting 404 error when using https

We're using AJAX WCF service for javascript calls.
All worked well while we were running under http, but when we went to production and switched to https, all of a sudden service wasn't workin. Following was happening:

http://mytest.com/test.svc/js - worked fine
https://mytest.com/test.svc - worked fine
https://mytest.com/test.svc/js - 404 error

Turned out we were missing binding configuration for https. This blogpost describes how to fix it (i'm attaching the XML fragment just in case the blog goes missing...)

<system.serviceModel>
<behaviors>    
 <endpointBehaviors>
  <behavior name="TestServiceAspNetAjaxBehavior">
   <enableWebScript />
  </behavior>
 </endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
 <service name="TestService">
  <endpoint address="" behaviorConfiguration="TestServiceAspNetAjaxBehavior"
   binding="webHttpBinding" bindingConfiguration="webBinding" contract="TestService" />
 </service>
</services>
 <bindings>
   <webHttpBinding>
     <binding name="webBinding">
       <security mode="Transport">
       </security>
     </binding>
   </webHttpBinding>
 </bindings>
</system.serviceModel>

Thursday, January 13, 2011

ASP.Net Web Service Reference error

I've encountered interesting error when dealing with web-services in Web Site (ASP.Net 4.0).
Scenario:
MyWeb - ASP.Net 4.0 web site project
MyService - ASP.Net WCF service
MyCode.dll - library share user by both, MyWeb and MyService.

Now, the issue is when you change MyCode, recompile MyService and do "Update Service Reference" in the MyWeb. What I found, that I start getting compilation errors saying that the client class from the MyService reference is not known (as if the reference was missing).

Cause: The MyWeb project was referencing the MyCode library not as a project, but rather as DLL reference.

Solution: Quite obvious - either use project reference or update the DLL used by the web-site.

This behavior is to be expected, however if you don't realize that you're not using same DLL version from both MyService and MyWeb, it can be quite confusing.

Wednesday, August 15, 2007

Calling WebService from VBA

Instead of struggling with writing the code yourself, use Microsoft Office 2003 Web Services Toolkit 2.01. It generates the proxy for you - nice and easy.