Silverlight not finding clientaccesspolicy.xml in Owin self hosted Web Api -
i aware of hundreds of similar questions silverlight , clientaccesspolicy.xml losing head here. i've gone through posts on stackoverflow, tried of suggestions , i'm still stuck.
i have sl client calling method in owin self-hosted web api. i've simplified api service this example, there no unnecessary complexity involved. api running on port 9000 example.
the problem 404 error when calling method in api. using fiddler can tell it's not finding clientaccesspolicy.xml. i've copied xml file (and crossdomain.xml) locations can think of, , of other posts have suggested.
can point out error or help me in right direction? here snippets:
clientaccesspolicy.xml:
<?xml version="1.0" encoding="utf-8"?> <access-policy> <cross-domain-access> <policy> <allow-from http-request-headers="soapaction"> <domain uri="http://*"/> <domain uri="https://*"/> </allow-from> <grant-to> <socket-resource port="9000" protocol="tcp" /> <resource path="/" include-subpaths="true"/> </grant-to> </policy> </cross-domain-access> </access-policy>
program.cs
static void main(string[] args) { string baseaddress = "http://localhost:9000/"; console.writeline("connected.."); var server = webapp.start<startup>(url: baseaddress); console.readline(); console.writeline("disconnecting.."); server.dispose(); }
service agent in sl:
public async task testapi() { seek { httpclient client = new httpclient(); var response = await client.getasync("http://localhost:9000/api/test"); var result = await response.content.readasstringasync(); ... bla bla bla } grab (exception e) { throw new exception(e.message); } }
when using self hosting have serve policy file listening request policy , passing policy file.
see: cross domain policy file on net.tcp wcf servicehost , silverlight 5
silverlight-5.0 owin asp.net-web-api2
No comments:
Post a Comment