Hey all,
I have a RadComboBox that I want to have pull data from a separate WCF service project, and I've followed the guide for linking a RadComboBox to a WCF service (http://www.telerik.com/help/aspnet-ajax/combobox-loading-items-from-wcf-service.html), but it will not work when the service is in a WCF project separate from the web project. I first tried configuring the RadComboBox to use a service within the same web project and that worked great, but once I moved the service to a separate project, it started giving the error "The server method GetData failed".
So, I have two projects in my solution. A WCF service project and a web project, and the web project has a service reference to the WCF service project. The web project has the following RadComboBox on its default page:
The WCF service project has the following ajax-enabled service:
And the service project has the following web.config file:
When the service was in the web project and working properly, the same serviceModel section of the above config file was in the web project's web.config. When I moved the service to its own project, I pulled that section out and put it in the service project's web.config. The only difference is I set httpGetEnabled to true (so that the service could be referenced and the wsdl could be viewed).
But when the RadComboBox tries to pull data from the service, it gives the error message "The server method GetData failed". What am I missing? Thanks!
-Joey
I have a RadComboBox that I want to have pull data from a separate WCF service project, and I've followed the guide for linking a RadComboBox to a WCF service (http://www.telerik.com/help/aspnet-ajax/combobox-loading-items-from-wcf-service.html), but it will not work when the service is in a WCF project separate from the web project. I first tried configuring the RadComboBox to use a service within the same web project and that worked great, but once I moved the service to a separate project, it started giving the error "The server method GetData failed".
So, I have two projects in my solution. A WCF service project and a web project, and the web project has a service reference to the WCF service project. The web project has the following RadComboBox on its default page:
<
telerik:RadComboBox
ID
=
"RadComboBox1"
EnableLoadOnDemand
=
"true"
Width
=
"250"
runat
=
"server"
>
<
WebServiceSettings
Method
=
"GetData"
Path
=
"http://localhost:4835/Service.svc"
/>
</
telerik:RadComboBox
>
The WCF service project has the following ajax-enabled service:
namespace
WcfService
{
[ServiceContract(Namespace =
""
)]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public
class
Service
{
[OperationContract]
[WebGet(ResponseFormat=WebMessageFormat.Xml)]
public
RadComboBoxData GetDataTelerik(RadComboBoxContext context)
{
RadComboBoxData data =
new
RadComboBoxData();
//todo: call db..
RadComboBoxItemData item =
new
RadComboBoxItemData();
item.Text =
"rawr"
;
item.Value =
"teh value"
;
data.Items =
new
RadComboBoxItemData[] { item };
return
data;
}
}
}
And the service project has the following web.config file:
<?
xml
version
=
"1.0"
?>
<
configuration
>
<
system.web
>
<
compilation
debug
=
"true"
targetFramework
=
"4.0"
/>
</
system.web
>
<
system.serviceModel
>
<
behaviors
>
<
endpointBehaviors
>
<
behavior
name
=
"WcfService.ServiceAspNetAjaxBehavior"
>
<
enableWebScript
/>
</
behavior
>
</
endpointBehaviors
>
<
serviceBehaviors
>
<
behavior
>
<
serviceMetadata
httpGetEnabled
=
"true"
/>
</
behavior
>
</
serviceBehaviors
>
</
behaviors
>
<
serviceHostingEnvironment
aspNetCompatibilityEnabled
=
"true"
multipleSiteBindingsEnabled
=
"true"
/>
<
services
>
<
service
name
=
"WcfService.Service"
>
<
endpoint
address
=
""
behaviorConfiguration
=
"WcfService.ServiceAspNetAjaxBehavior"
binding
=
"webHttpBinding"
contract
=
"WcfService.Service"
/>
</
service
>
</
services
>
</
system.serviceModel
>
<
system.webServer
>
<
modules
runAllManagedModulesForAllRequests
=
"true"
/>
</
system.webServer
>
</
configuration
>
When the service was in the web project and working properly, the same serviceModel section of the above config file was in the web project's web.config. When I moved the service to its own project, I pulled that section out and put it in the service project's web.config. The only difference is I set httpGetEnabled to true (so that the service could be referenced and the wsdl could be viewed).
But when the RadComboBox tries to pull data from the service, it gives the error message "The server method GetData failed". What am I missing? Thanks!
-Joey