.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

How to view AJAX-enabled WCF service (.svc) file in browser

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :WCF
Hi I have created an AJAX-enabled WCF project TestWCFAjax having Default.aspx that uses the Add.svc web service.  When I select Default.aspx and run the app in VS 2008. It works perfectly, calls the webservice to do the desired task. But, I have following questions: 1. When I select the Add.svc.cs and run through VS2008, it throws an error "The type 'TestWCFAjax.Add', provided as the Service attribute value in the ServiceHost directive could not be found.". And the web url on the browser points to http://localhost:4960/Add.svc. I didn't create any virtual directory. I tried creating one that points to my application folder - TestWCFAjax. Still it doesn't work. How can I view Add.svc service on the browser like what we can do with normal WCF service? 2. How can I use Add.svc (AJAX-enabled WCF Service) in another web application? Regards

View Complete Post

More Related Resource Links

Infopath 2007 print view in browser enabled form with Print button


Hi i create a  print view brower enabled form in Infopath 2007 with header and footer. In Infopath works fine. Margin was ok, header and footter to. But then i try to print this browser the margin, header and footer it changes to default setting of browser ? I try also create a print button in form with VS 2008 code, but method :

this.print(); not working.

It is possible to print the "print view" in browser as the same like in Infopath 2007? Does anyone have the code how to create a print button in C# on browser enabled form?

Separate sessions in browser tabs together with an ajax enabled web site


I want my tabs in my browser to have separate sessions. I  was told to use

<sessionState mode="InProc" cookieless="UseUri"></sessionState> in web.config

 but when I read about it here: http://msdn.microsoft.com/en-us/library/h6bb9cz9(v=VS.100).aspx

the text says "When you configure an AJAX-enabled ASP.NET Web site, use only the default value of UseCookies for the cookieless attribute. Settings that use cookies encoded in the URL are not supported by the ASP.NET AJAX client script libraries."

I'm using Ajax so are there any ideas what I can do about this problem.

With Anonymous access disabled, is there any way to use an AJAX-enabled WCF Service?

I have a website where anonymous access is disabled but I want to user an ajax-enabled WCF service. Configuring the service's binding security to use "TransportCredentialOnly" with clientCredentialType="Windows" seems like the obvious thing to do; indeed, many posts in various places suggest this approach. Unfortunately, however, it doesn't work. I always get the error "Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service." How can I configure the service to function correctly. I'm running IIS 7.5 with .Net framework 4.0. Thanks.

Adding AJAX-enabled WCF Service to the Solution throws an error

Hi I am just trying to learn Ajax enabled WCF service, when I try to create a new web application and add new item "AJAX-enabled WCF Service" I get an error message that "The extension of type 'System.ServiceModel.Configuration.WebScriptEnablingElement, System.ServiceModel.Web, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is not registered in the extension collection 'behaviorExtensions'. I had .net2.0/VS2005 and then I installed VS2008. I thought it might be an issue with Machine.config. So I am attaching my machine.config info. <?xml version="1.0" encoding="UTF-8"?>    <!--    Please refer to machine.config.comments for a description and    the default values of each configuration section.     For a full documentation of the schema please refer to    http://go.microsoft.com/fwlink/?LinkId=42127     To improve performance, machine.config should contain only those    settings that differ from their defaults.    -->    <configuration>      <configSections>    <section name="appSettings" type="System.Configuration.AppSettingsSection, System.Configuration, Version=, Culture=neutral, Publi

Problem when ajax enabled WCF Service returns EDM Objects

Hi there, Could you please help me with the following problem? - I have ajax enabled WCF service. It returns Customer Entity Type.  For example: [OperationContract]             public List<Customer> GetCustomers()        {            using (NorthwindEntities context = new NorthwindEntities())            {                return context.Customers.Take(10).ToList();            }        }  - But AJAX Client Library cannot display Customer( as Entity). I cannot see data in browser. Even it hits the breakpoint and returns 10 customers. - But if I make a plain class called "Customer2" with same fields and copy all the "Customer" into "Customer2" then it works. In this case I return List<Customer2>. Then it works like a champ and I can see customer in AJAX/DataView/List. - Why I need to create a class? Is this JSON problem? DataView accepts JSON data format. - I use VS2010, AJAX 4.0. - Do I need to add something else along with [OperationContract].   Regards, Rajan  

How to get web service address in a ajax enabled page to use it in javascript


Hii everyone,

I have a requirement where I am using web service from  a server and adding that to a client

website .I have referenced the web service in my client web site  but not able to get the

address of web service. When I click on the path I get the disco file of web service and

the result is not displayed.My code is like this

</p><p>&lt;script&nbsp; language="javascript"&gt;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function btnadd_Click() {

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var x = document.getElementById('txtA').value;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var y = document.getElementById('txtB').value;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var ans = WebService.Add(parseInt(x), parseInt(y), OnComplete, OnTimeOut, onerror);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return true;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }


Web script enabled service - AJAX problem


I have the following REST GET service which is web script enabled using <enableWebScript /> attribute in Web.config.


[WebInvoke (Method ="GET" , BodyStyle =

Getting intellisense to work in VS 2010 for a ajax-enabled WCF Service


Hi all,

I'm experimenting with WCF services inside of a test project.  I have seen documentation on various blogs etc. that tell me that Intellisense is available for WCF services that I write.  However, I cannot get this intellisense to work in VS 2010.  I have tried the same simple steps in VS 2008 and can get intellisense working.

Has something changed here?  Is there a chance I am doing something wrong?

I create a new web application project.
I add an ajax-enabled WCF Service.
I add the script manager control to the page and then reference my wcf service.
When I go to create an object proxy to the service the intellisense is not available.
I know my code is working because I tested it.  It can call the web service and gets the expected result.  Just no intellisense.

I've also tried referencing intellisense from a separate .js file using the following technique:
/// <reference path="MicrosoftAjax.js" />
/// <reference path="MyService.svc" />

This has also not worked.  I have verified that my pathing information etc. is correct. 

Anyway, this is driving me nuts so I'm hoping somebody can shed some light on this.

AJAX enabled WCF Service Question


From a pure html/javascript (jquery)/ajax client I need to access a WCF Service. For this reason I (probably) need to create an AJAX enable WCF Service.
Should I create an ASP.NET empty web application project and in this project add an AJAX enabled WCF Service or should I create an WCF Service Appication or WCF Service Library project and add in one of these projects my AJAX enabled WCF Service?



Ajax enabled WCF Service stops working with Undefined error


 I have an Ajax Enabled WCF service that I call from Javascript.  It works fine, but often after I make unrelated changes to the website it will fail and Javascript will report an 'Undefined' error.  I can easily fix it by deleting the service, removing the system.serviceModel section of the Web.config and then recreating the service.  I don't have to change any of the references in the .aspx or .js files.  Also, the replacement service has identical code in the .config, .cs and .svc files (I don't see any differences).  This morning, I only made some cosmetic changes and the service stopped working again. 

Any insight into what I am doing wrong?

Ajax Enabled Gridview using JavaScript in ASP.NET

Before explaining the article, I would like to thank all readers who read my article and voted for it. Your appreciation for my article gives me strength to write more good articles. Hope in future I will get your valuable comments and suggestions. Now I won't waste your time and come back to the topic. I have written this article on 'Ajax Enabled Gridview Using JavaScript in ASP.NET'. In this article, I will show you how to make a Gridview using a simple HTML table, JavaScript and XML HTTP for Ajax call without using any ASP.NET control.

Using Code

WebDev.WebServer.exe has encounted a problem and needs to close when trying to view page in browser


Hi, whenever I load an aspx page in vwde2008, I get the message in the subject of this post.  After I click Ok on that, I get a dialog box, Unable to Connect to the ASP.Net development center.  What can I do to troubleshoot?

I am using Windows XP SP3, vwde2008 with SP1, on a HP desktop.  Also using Office 2003 if that is relevant at all.

Thanks, Justin

Cutting Edge: Building A Secure AJAX Service Layer


This month Dino builds a service layer that authenticates users of Silverlight 2 and ASP.NET AJAX services to prevent illegal access to sensitive back-end services.

Dino Esposito

MSDN Magazine September 2008

Extreme ASP.NET: Client-Side Web Service Calls with AJAX Extensions


Microsoft AJAX Library and the ASP.NET 2.0 AJAX Extensions provide a number of compelling features ranging from client-side data binding, to DHTML animations and behaviors. Learn all about them here.

Fritz Onion

MSDN Magazine January 2007

Ajax Popup Extender: Crashing the Browser



    I am using Ajax Popup extender as confirmation window. In my page, I am having multiple post backs for different cases. If I display ajax Popup extender, first few times it is working fine. After that, It is crashing the browser and i have to close the browser or it is closing the browser automatically.

Any Idea why it is happening? Did i miss anything?

My App details

IE Version : 6.0

.Net version: 3.5

Ajax version: 3.0.30512.20315



Uploading to SQL Server using AJAX muiltiple file uploader and dynamic SQL Server Tables


I am getting an error on the following code when trying to pload files directly to a database.  

 Incorrect syntax near ','.

 Incorrect syntax near 'image'.


    Private Sub Uploader_FileUploaded(ByVal sender As Object, ByVal args As UploaderEventArgs)

        Dim data() As Byte = New Byte((args.FileSize) - 1) {}

        Dim stream As Stream = args.OpenStream

        stream.Read(data, 0, data.Length)

    End Sub


Private Sub ButtonTellme_Click(ByVal sender As Object, ByVal e As EventArgs)


        Dim objConn As New SqlConnection("Data Source=mrpoteat.db.2798093.hostedresource.com; Initial Catalog=mrpoteat; User ID=mrpoteat; Password=Colgate23;")


        Dim strCommandText As String = ""

        For index = 1 To Attachments1.Items.Count Step 1

            strCommandText += "pic" + index.ToString() + Space(5)

Insert into SQL Server with ajax file uploader


I am getting error in here 


Incorrect syntax near '987'

987 is where i put clientname.text

        Dim objCmd As New SqlCommand("Create Table " + clientname.Text + "(name Varchar(50), event Varchar(50), date1 datetime, username Varchar(50), password Varchar(50), " + strCommandText + ")", objConn)

        objCmd.CommandType = CommandType.Text

        Dim objConn2 As New SqlConnection("Data Source=dddd.db.2.hostedresource.com; Initial Catalog=mrpoteat; User ID=xxxxx; Password=xxxxxx;")
        Dim strCommandText2 As String = ""
        For index2 = 1 To Attachments1.Items.Count Step 1
            If String.IsNullOrEmpty(strCommandText2) Then
                strCommandText = "@pic" + index2.ToString()

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend