Silverlight not finding clientaccesspolicy.xml in Owin self hosted Web Api -
I have information about hundreds of similar questions about Silverlight and ClientTexPolicy.exm but I'm losing my head here. I have gone through almost all the posts on the StackVarfarflow, I tried most suggestions and I still got stuck.
I have an SSL client who has simplified my API service for example, Owen Self-Hosted Web API, so there is no unnecessary complexity involved. This example is running on my API port 9000.
The problem is that I get a 404 error when calling the method in the API. By using Fidler I can tell that this client expedient policy. XML is not able to. I have copied the XML file (and Cross Domain .xml) to all locations, which I can think of, and what other suggestions have been made about
Can someone tell me my error or help me in the right direction? Here are some snippets:
clientaccesspolicy.xml:
& lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Access-Policy & gt; & Lt; Cross-domain use & gt; & Lt; Policy & gt; & Lt; Permission-from http-request-headers = "SOAPAction" & gt; & Lt; Domain yur = "http: // *" /> & Lt; Domain uri = "https: // *" /> & Lt; Allow / -to & gt; & Lt; For grant & gt; & Lt; Socket-Resource Port = "9000" Protocol = "TCP" /> & Lt; Resource path = "/" include- subpaths = "true" /> & Lt; / For grant & gt; & Lt; / Policy & gt; & Lt; / Cross-domain use & gt; & Lt; / Access-Policy & gt;
Program.cs
Fixed zero main (string [] args) {string baseAddress = "http: // localhost: 9000 /"; Console.WriteLine ("Connected .."); Var server = WebApp.start & lt; Startup & gt; (Url: baseAddress); Console.ReadLine (); Console.WriteLine ("Disconnect .."); Server.Dispose (); }
Service Agent in SL:
Public async Work Test API () {HTTP Client Client = New HTTP Client (); Var response = wait client.GetAsync ("http: // localhost: 9000 / api / test"); Var Results = Waiting for feedback. Content RedAssressingSync (); ... bla bla bla} hold (exception e) {new exception (e. Message); }}
When you are hosting your own policy, you must serve the policy file by listening to yourself. To request and to return the policy file.
See:
Comments
Post a Comment