Click here to Skip to main content
15,886,705 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hi Guys,

I have a WCF rest which is working fine in my development machine (Visual Studio web server). But I can not make it work in my QA server which is windows XP with IIS 5.1 (SSL enabled). ("Bad Request" or "not found")
If I go to the IIS and set the mapping ".*" to "aspnet_isapi.dll", then everything will be fine. but for some reason I don't want to do that (for example I will lose the default document behaviour!).

Is there any good way to solve this problem?

Here is my server code:
C#
[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode= AspNetCompatibilityRequirementsMode.Allowed)]
public class AjaxJSON : WCFBase

  [WebGet(ResponseFormat = WebMessageFormat.Json, UriTemplate= "/Obj/Get/Status/{ObjID}")]                
  public AjaxJSONResponse_ObjIDStatus getImage(string ObjID)
  {
     // Do something and return 
  }
}


and I have this code in my Global.asax

C#
RouteTable.Routes.Add(new ServiceRoute("Rest",
     new WebServiceHostFactory(),
     typeof(Test.AjaxJSON)));


XML
here is my config file ( application works in my development machine without this configuration using default configuration)

<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    <bindings>
        <basicHttpBinding>
            <binding name="AjaxJSONSBinding">
                <security mode="Transport">
                    <transport clientCredentialType="Windows" proxyCredentialType="None"/>
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <behaviors>
        <serviceBehaviors>
            <behavior name="AjaxJSONServiceBehavior">
                <serviceMetadata httpsGetEnabled="true"/>
                <serviceDebug includeExceptionDetailInFaults="false"/>
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <services>
        <service behaviorConfiguration="AjaxJSONServiceBehavior" name="Test.AjaxJSON">
            <endpoint address="" binding="basicHttpBinding" bindingConfiguration="AjaxJSONSBinding" contract="Test.AjaxJSON"/>
        </service>
    </services>
</system.serviceModel>


I have also tried calling the .svc from the Javascript (JQuery). but no chance!

all responses are welcome.

Thank you.
Posted

1 solution

OK, I think there is no way to do that!
But at least I have found why I could not make a call directly to the .svc/...
for the other peaoples who may have the same problem:

I had my service in a folder (WCF) inside my asp.net site which is a normal directory and not a "virtual directory". So I had to call my service like this:
https://server/[virtualFolderName]/WCF/AjaxJSON.svc/Obj/Get/Status/[ObjId]
which did not work!

I remove the AjaxJson.svc and put it directly in the root folder and it solved the problem!

now the path is:
https://server/[virtualfoldername]/AjaxJson.svc/Obj/Get/Status/[ObjId]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900