EDN Admin
Well-known member
Hi,
I have created a Ajax enabled WCF Service and I want to call it through javascript.
I am getting Null ReferenceException when I am adding the service reference to ScriptManager, Following is the code:
<div style="color:Black;background-color:White; <pre>
ScriptManager manager = ScriptManager.GetCurrent(Page);
ServiceReference reference = <span style="color:Blue; new ServiceReference(<span style="color:#A31515; "http://localhost:59769/LookupService.svc");
manager.Services.Add(reference);
[/code]
The service is running and when I ckick on the URL provided in the path, I am able to browse the service.
Also I have checked the attributes to make a service ajax enabled:
<pre>[ServiceContract(Namespace = "Services.Ajax.Lookup")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class LookupService[/code]
<br/>
Also in default.config, entries seem to be correct:
<pre> <system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="default"/>
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="Services.Ajax.Lookup.LookupServiceAspNetAjaxBehavior
<enableWebScript/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="Services.Ajax.Lookup.LookupServiceServiceBehavior
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<services>
<service name="Services.Ajax.Lookup.LookupService" behaviorConfiguration="Services.Ajax.Lookup.LookupServiceServiceBehavior
<endpoint name="AddressEndPoint"
address="Address"
behaviorConfiguration="Services.Ajax.Lookup.LookupServiceAspNetAjaxBehavior"
binding="webHttpBinding"
contract="Services.Ajax.Lookup.LookupService"/>
</service>
</services>
</system.serviceModel>[/code]
<br/>
Iam I missing something here..??
<hr class="sig Warm Regards, Deepak Pandit Please remember to mark the replies as answers or helpful if they help
View the full article
I have created a Ajax enabled WCF Service and I want to call it through javascript.
I am getting Null ReferenceException when I am adding the service reference to ScriptManager, Following is the code:
<div style="color:Black;background-color:White; <pre>
ScriptManager manager = ScriptManager.GetCurrent(Page);
ServiceReference reference = <span style="color:Blue; new ServiceReference(<span style="color:#A31515; "http://localhost:59769/LookupService.svc");
manager.Services.Add(reference);
[/code]
The service is running and when I ckick on the URL provided in the path, I am able to browse the service.
Also I have checked the attributes to make a service ajax enabled:
<pre>[ServiceContract(Namespace = "Services.Ajax.Lookup")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class LookupService[/code]
<br/>
Also in default.config, entries seem to be correct:
<pre> <system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="default"/>
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="Services.Ajax.Lookup.LookupServiceAspNetAjaxBehavior
<enableWebScript/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="Services.Ajax.Lookup.LookupServiceServiceBehavior
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<services>
<service name="Services.Ajax.Lookup.LookupService" behaviorConfiguration="Services.Ajax.Lookup.LookupServiceServiceBehavior
<endpoint name="AddressEndPoint"
address="Address"
behaviorConfiguration="Services.Ajax.Lookup.LookupServiceAspNetAjaxBehavior"
binding="webHttpBinding"
contract="Services.Ajax.Lookup.LookupService"/>
</service>
</services>
</system.serviceModel>[/code]
<br/>
Iam I missing something here..??
<hr class="sig Warm Regards, Deepak Pandit Please remember to mark the replies as answers or helpful if they help
View the full article