service not defined when precompiling a web app with AJAX-enabled WCF Service
I created a web application in which one .aspx page calls an AJAX-enabled WCF service (created with Visual Studio 2008 Add New Item -> AJAX-enabled WCF Service).
when I test the application in Visual Studio, it works开发者_如何学JAVA and the page can call the service from Javascript but when I "publish" (code precompilation using Visual Studio) it to the local IIS Server, I get an error :
"service ThunServ is undefined" in my .html page.
I've been spending quite a time to solve this problem but to no avail.
Omar
Not sure if you managed to resolve the issue.
This problem also occur when you try to access the page using HTTPS.
All you need to do is create a in Web.config and set the security mode to Transport that means transport-level security is used with HTTP requests.
example:
<bindings>
<webHttpBinding>
<binding name="AjaxBinding">
<security mode="Transport"></security>
</binding>
</webHttpBinding>
</bindings>
in endpoint configuration of your services section add:
bindingConfiguration="AjaxBinding"
That should fix the problem.
精彩评论