IIS Enable RPC Connections
-
19-04-2021 - |
سؤال
I'm trying to create a JSON RPC server in Zend Framework hosted on IIS. Connections to my server work fine using this example, taken from http://site1/request.html:
<HTML>
<HEAD>
<SCRIPT LANGUAGE="javascript" SRC="js/jquery-1.3.min.js"></SCRIPT>
<SCRIPT LANGUAGE="javascript" SRC="js/json2.js"></SCRIPT>
<SCRIPT LANGUAGE="javascript" SRC="js/jquery.zend.jsonrpc.js"></SCRIPT>
</HEAD>
<BODY>
<script type="text/javascript">
$(document).ready(function(){
var myApi = jQuery.Zend.jsonrpc({url: '/api/1.0/jsonrpc'});
});
</script>
</BODY>
</HTML>
I have two sites hosted locally (on IIS 7.5), and the calls work fine to the RPC Server on the same domain - above the url is given as '/api/1.0/jsonrpc'
.
If I change this to the url of a another site, e.g. http://site2/api/1.0/jsonrpc
the calls fail.
I belive IIS is disallowing anonymous access for the RPC calls, hence why it works from a call made within the current 'doimain'.
Can anyone tell me how to make IIS play nice and allow these sort of requests?
المحلول
Looks like this is related to a cookie sent with the request. The domain doesn't match when the response comes back so nothing is returned. Time to rebuild!