Click here to Skip to main content
15,920,602 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
        <add name="Access-Control-Allow-Origin" value="*" />
        <add name="Access-Control-Allow-Headers" value="Content-Type" />
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
    <add key="ConnectionString" value="Data Source=ServerDatabase; Initial Catalog=NewDataBase; User ID=pras; Password=rita" />

    <compilation debug="true" targetframework="4.5" />
    <httpruntime targetframework="4.5" />
        <authentication mode="Windows" />
        <rolemanager enabled="true" />
        <binding name="crossDomain" crossdomainscriptaccessenabled="true" />
        <behavior name="tSeyvaWCFEndPointBehavior">
          <webhttp />
        <behavior name="tSeyvaServiceBehavior">
          <servicemetadata httpgetenabled="true" httpsgetenabled="true" />
          <servicedebug includeexceptiondetailinfaults="true" />
      <add binding="basicHttpsBinding" scheme="https" />
    <servicehostingenvironment aspnetcompatibilityenabled="true" multiplesitebindingsenabled="true" />
      <service name="AppServices.AppService" behaviorconfiguration="tSeyvaServiceBehavior">
        <endpoint address="" behaviorconfiguration="tSeyvaWCFEndPointBehavior">
                  bindingConfiguration="crossDomain" binding="webHttpBinding"

    <modules runallmanagedmodulesforallrequests="true" />
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
    <directorybrowse enabled="true" />
    <handlers accesspolicy="Read, Execute, Script" />


**And this is the ajax call I have made:**

        var data = { 'logindetails': { 'UserName': UN, 'Password': PW } };
        var st = JSON.stringify(data);
            type: "POST",
            url: "",
            data: st,
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (result) {
                //// Play with response returned in JSON format
            error: function (jqXHR, textStatus, errorThrown) {
                alert(jqXHR + "-" + textStatus + "-" + errorThrown);


When I host my Wcf service in my local IIS and make an ajax call from my local machine itself, its working fine, but when I host my Wcf service in server and make an ajax call to that Wcf service hosted in server, from my local machine, I couldn't access it.
Please go through this code and help me in finding the problem
Updated 2-Dec-13 20:46pm
RaisKazi 3-Dec-13 10:02am    
This could be Firewall issue.

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