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 6474685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:37:00+00:00 2026-05-25T06:37:00+00:00

I am currently maintaining and developing a website which uses a lot of webservices

  • 0

I am currently maintaining and developing a website which uses a lot of webservices in an ajax way.

Registering of the services is done in the aspx like this:

<asp:ScriptManagerProxy id="ScriptManager1" runat="server">
        <services>    
            <asp:ServiceReference Path="WebServices/WSAdministrator.asmx"></asp:ServiceReference>
        </services>
</asp:ScriptManagerProxy>

and consuming the services in the javascript is done like this

WSAdministrator.GetConsumerClubInfo(ConsumerClubId,
                                    OnSucceededToGetConsumerClubInfo,
                                    OnFailedToGetConsumerClubInfo);

I want to know if I can reference a self-hosted WCF service(on the same machine) this easily.

any suggestions?

EDIT: The WCF service is running on a windows service, it exposes both webHttpBinding and basicHttpBinding endpoints.

After Reading ASP.Net WCF Service with no App_Code , I realized that I should just create an svc file which will act as a reference to the service.

I created this svc file:

<%@ ServiceHost Language="C#" Service="MyService.Namespace.Contract" %>

and in the web.config file I added these lines:

        <services>
        <service name="MyService.Namespace.Contract">
            <endpoint address="setAddress" binding="basicHttpBinding" contract="MyService.Namespace.ContractInterface"/>
        </service>
    </services>

The address is working, but when I try to access the reference from the svc, I get the following error:

The type ”, provided as the Service attribute value in the
ServiceHost directive could not be found.

What am I missing here?

Note: There have been some nice answers, but all to things I already know, my question is about how to reference my Self Hosted WCF service using asp.net so that I can use it from javascript, that’s all, and for that I still have no answers…

I saw some replies to similar questions telling there should be an IIS hosted service acting as a “pipe” to the actual service, and then the ScriptManager should reference it, Maybe that’s the only answer…

  • 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-25T06:37:01+00:00Added an answer on May 25, 2026 at 6:37 am

    When you are self hosting your WCF Service you do not use .SVC file, but create the service host in your windows service’s OnStart method in the following way.

    WebServiceHost myServiceHost = null;
    if (myServiceHost != null)
    {
        myServiceHost.Close();
    }
    
    myServiceHost = new WebServiceHost(typeof(YourClassName));
    myServiceHost.Open();
    

    If you want to host your service to support WebHttpBinding then the hosting class should be WebServiceHost and if you want to host wsHttpBinding or any other you should use ServiceHost.

    Once service starts running clients can connect to it.

    The following link contains step by step process for doing it.

    If you have to support RESTful service that is able to talk to using AJAX and Jquery then you should go with WebServiceHost and you would decorate your operation contracts in the following way.

    [ServiceContract()]
    public interface IMyInterface
    {
       [OperationContract]
       [WebInvoke(Method = "GET",
       ResponseFormat = WebMessageFormat.Json,
       UriTemplate = "GetArray",
       BodyStyle = WebMessageBodyStyle.Bare)]
       MyArray[] GetArray();
    } 
    

    You can find some info on this even in the following question.

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

Sidebar

Related Questions

I'm currently maintaining some web server software and I need to perform a lot
I am currently maintaining some code, which is likely to be refactored soon. Before
I am maintaining an application which currently checks to see whether MS Access 2007
I'm developing (.NET MVC) a large website which has the following specifications: Database pages
I'm currently maintaining some flex code and noticed very many functions which are declared
I'm currently maintaining a legacy C++ application which has put all the global application
I'm currently maintaining an "old" system written in C# .NET, removing some obsolete features
I'm currently maintaining a project I've inherited from some one else and the SVN
I'm maintaining an in-house ORM written in C#, and it currently does not have
I've got an older ASP/VBScript app that I'm maintaining/upgrading and its currently using the

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.