views:

236

answers:

1

Hi,

I'm trying to consume WCF service using asp.net2.0

Here are some details:

1) WCF service hosted on different server IIS

URL : http://myserver/Service.svc

2) Web.config

bindings>
wsHttpBinding>
binding name="ServiceBinding" maxReceivedMessageSize="2147483647"
readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/
/binding>
/wsHttpBinding>
/bindings>
services>
service name="MYNameSpace.Service" behaviorConfiguration="ServiceBehavior"
endpoint name="ServiceEndPoint" address="http://myserver/Service.svc" binding="wsHttpBinding" bindingConfiguration="ServiceBinding" contract="MyNameSpace.IService"/
/service

3) asp.net page

asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
        Services
            asp:ServiceReference Path="~/Service.svc" /
        /Services
        Scripts
            asp:ScriptReference Path="~/myjs.js" /
        /Scripts
    /asp:ScriptManager

4) myjs.js

MYNameSpace.IService.MyMethod();

*** here it throws error that 'MyNameSpace' is not defined.

Everything works fine on my local machine. Problem when I try to consume from asp.net2.0 application

Any inputs will be truly appreciated.

Thanks in advance

A: 

Have a look at this article - Exposing WCF Services to Client Script. Looks like you may be missing the ServiceContract attribute.

pFrenchie