Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4000000
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:43:39+00:00 2026-05-20T07:43:39+00:00

i have wcf service hosed in sharepoint application. But when i try to call

  • 0

i have wcf service hosed in sharepoint application. But when i try to call method from jquery it always fails.

I have tested service with such string:

ttp://localhost/_vti_bin/webservices/wcfservice.svc/**mex**

and have normal response.

WCF test client have response too.

But in my javascript code i recieve always error. Why? What i am doing wrong?

   $.ajax({
        url: "/_vti_bin/webservices/wcfservice.svc/HelloWorld",
        dataType: 'json',
        contentType: "application/json",
        success: function (res) {
            alert("good answer");
        },
        error: function (xhr) {
            alert("error");

            return;
        }
    });

Browser response:

<wsdl:definitions name="WCFService" targetNamespace="http://tempuri.org/">

<wsp:Policy wsu:Id="BasicHttpBinding_WCFService_policy">

<wsp:ExactlyOne>

<wsp:All>
<http:NtlmAuthentication/>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>

<wsp:Policy wsu:Id="BasicHttpBinding_WCFService2_policy">

<wsp:ExactlyOne>

<wsp:All>
<http:NtlmAuthentication/>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>

<wsdl:types>

<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://localcomputer/_vti_bin/.WebServices/WCFService.svc/mex xsd=xsd0" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="http://localcomputer/_vti_bin/.WebServices/WCFService.svc/mex xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
</xsd:schema>
</wsdl:types>

<wsdl:message name="WCFService_HelloWorld_InputMessage">
<wsdl:part name="parameters" element="tns:HelloWorld"/>
</wsdl:message>

<wsdl:message name="WCFService_HelloWorld_OutputMessage">
<wsdl:part name="parameters" element="tns:HelloWorldResponse"/>
</wsdl:message>

<wsdl:portType name="WCFService">

<wsdl:operation name="HelloWorld">
<wsdl:input wsaw:Action="http://tempuri.org/WCFService/HelloWorld" message="tns:WCFService_HelloWorld_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/WCFService/HelloWorldResponse" message="tns:WCFService_HelloWorld_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>

<wsdl:binding name="BasicHttpBinding_WCFService" type="tns:WCFService">
<wsp:PolicyReference URI="#BasicHttpBinding_WCFService_policy"/>
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl:operation name="HelloWorld">
<soap:operation soapAction="http://tempuri.org/WCFService/HelloWorld" style="document"/>

<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>

<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>

<wsdl:binding name="BasicHttpBinding_WCFService1" type="tns:WCFService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl:operation name="HelloWorld">
<soap:operation soapAction="http://tempuri.org/WCFService/HelloWorld" style="document"/>

<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>

<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>

<wsdl:binding name="BasicHttpBinding_WCFService2" type="tns:WCFService">
<wsp:PolicyReference URI="#BasicHttpBinding_WCFService2_policy"/>
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl:operation name="HelloWorld">
<soap:operation soapAction="http://tempuri.org/WCFService/HelloWorld" style="document"/>

<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>

<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>

<wsdl:service name="WCFService">

<wsdl:port name="BasicHttpBinding_WCFService" binding="tns:BasicHttpBinding_WCFService">
<soap:address location="http://localcomputer/_vti_bin/.WebServices/WCFService.svc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Code of service:

[BasicHttpBindingServiceMetadataExchangeEndpoint]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
    [ServiceContract]
    public class WCFService 
    {
        // To test this service, use the Visual Studio WCF Test client
        // set the endpoint to http://<Your server name>/_vti_bin/WebServices/WCFService.svc/mex
        [OperationContract]
        //[WebGet(UriTemplate = "HelloWorld", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
        [WebInvoke(RequestFormat = WebMessageFormat.Json, UriTemplate="/HelloWorldM", BodyStyle = WebMessageBodyStyle.Wrapped)]
        public string HelloWorld()
        {
            return "Hello World from WCF and SharePoint 2010";
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T07:43:40+00:00Added an answer on May 20, 2026 at 7:43 am

    Try to use MultipleBaseAddressWebServiceHostFactory instead of MultipleBaseAddressBasicHttpBindin­gServiceHostFactory in SVC files.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WCF Service hosted on a server with Real IP but no
I'm fairly new to WCF but I have a WCF Service hosted in IIS
I have a WCF-REST service with one method which returns a string: [ServiceContract] public
I have my WCF Service hosted in Windows Service. The client application is a
I have a WCF service hosted in a Windows Forms application (.NET C# 4).
Have a WCF service (hosted in IIS 6.0) that takes an XML feed from
I have a WCF Ajax-Service hosted within a Web Application (.NET 4.0, C#). I
I have a WCF service hosted on a server. A client application is accessing
I have a WCF service hosted at IIS7 web application. It's created by a
I have WCF service which launches the remote process from Process.Start successfully on stand

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.