Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
Facing problem in wcf method calling through jquery

Quote:
Failed to load resource: the server responded with a status of 405 (Method Not Allowed)
Default.aspx:1 XMLHttpRequest cannot load http://pc174398.cts.com/CTService/WCFTestDemo.Service1.svc/GetData. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:57065' is therefore not allowed access. The response had HTTP status code 405.


wcf config file is
Quote:
<configuration>

<appsettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true">

<system.web>
<compilation debug="true">


<system.webserver>
<modules runallmanagedmodulesforallrequests="true">
<directorybrowse enabled="true">


<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.servicemodel>
<servicehostingenvironment aspnetcompatibilityenabled="false" multiplesitebindingsenabled="true">

<services>
<service name="WCFTestDemo.Service1" behaviorconfiguration="ServiceBehavior">
<host>
<baseAddresses>
<add baseaddress="http://localhost/WCFTestDemo/Service1.svc">
</baseAddresses>

<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address="" name="webHttp" binding="webHttpBinding" bindingconfiguration="BindingWeb" contract="WCFTestDemo.IService1" behaviorconfiguration="EndpBehavior">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<!--<identity>
<dns value="localhost">
-->

<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange">


<behaviors>
<servicebehaviors>
<behavior name="ServiceBehavior">
<!-- To avoid disclosing metadata information,
set the values below to false before deployment -->
<servicemetadata httpgetenabled="True" httpgeturl="true" httpsgetenabled="false">

<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<servicedebug includeexceptiondetailinfaults="true">


<endpointbehaviors>
<behavior name="EndpBehavior">
<webhttp helpenabled="true">
<enablewebscript>



<bindings>

<webhttpbinding>
<binding name="BindingWeb" crossdomainscriptaccessenabled="true">
<security mode="None">
<transport clientcredentialtype="None"> <!--<message establishsecuritycontext="false">-->








<!--<protocolmapping>
<add binding="webHttpBinding" bindingconfiguration="BindingWeb" scheme="http">

-->



Posted
Comments
F-ES Sitecore 16-Jul-15 6:37am    
google "wcf No 'Access-Control-Allow-Origin' header is present on the requested resource", lots of info on solving this

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