0

I've made simple AJAX enabled WCF which runs on localhost, but when I tried it to over HTTP, WCF is not running. How do I configure web config for it to host over HTTP? My web config which created automatically adding WCF and running on localhost:

<system.serviceModel>
    <behaviors>
      <endpointBehaviors>
        <behavior name="ASPXCommerceWCFServiceAspNetAjaxBehavior">
          <enableWebScript />
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
    <services>
      <service name="ASPXCommerceWCFService">
        <endpoint address="" behaviorConfiguration="ASPXCommerceWCFServiceAspNetAjaxBehavior"
          binding="webHttpBinding" contract="ASPXCommerceWCFService" />
      </service>
    </services>
  </system.serviceModel>
Nic
  • 13,287
  • 7
  • 40
  • 42
  • Is your client running on localhost with the service on a different machine? You can't do cross-domain calls like that. – Tim Sep 01 '11 at 06:47
  • yeah i know but dnt know how to configure please provide sample code of config – jpt bakamaru Sep 01 '11 at 07:48

1 Answers1

0

It sounds like you're trying to make a cross-domain call, which modern browsers block. There appear to be some work-arounds:

Cross-site ajax call to a WCF Service

JSONP

Cross-Domain AJAX Enabled WCF Service

Community
  • 1
  • 1
Tim
  • 28,212
  • 8
  • 63
  • 76
  • calling cross domain ive thought about later.. but right now i need to know hosting it on over htttp... – jpt bakamaru Sep 02 '11 at 10:17
  • You said it runs on localhost, right? I assume you're using something like `http://localhost` - that's running over HTTP. If your client app is on your local machine, and you're hosting the service on *another* machine - like `http://somemachine/`, you will have to deal with cross domain calls. – Tim Sep 02 '11 at 17:48
  • yeah i get it...but i think you are not getting my problems..ive domain www.domain.com and ive to host svc with in this domain only sothat function may call this service and run..right now m not able to recive that service ? – jpt bakamaru Sep 05 '11 at 05:31