Click here to Skip to main content
15,843,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a Windows Service which self hosts a WCF service. The Windows Service contains all of the logic. The WCF Service call using ajax but browsers sending error like Method Not allowed and No Access-Control-Allow-Origin. using this
<pre>WebServiceHost host = new WebServiceHost(typeof(Generat), new Uri("http://localhost:8800/GetClient"));
            ServiceMetadataBehavior smb = new Ser<code></code>viceMetadataBehavior();
            smb.HttpGetEnabled = true;
            smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;

What I have tried:

self host wcf service successfully and windows service also start properly but when call from another web application give error
and call using ajax

                url: 'http://localhost:8800/BCon/GetClient',
                type: 'GET',
                contentType: 'application/json;charset-uf8',
                dataType: "json",
            }).success(function (data) {
            }).error(function (error) {
Updated 22-Nov-17 21:52pm

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900