Lets understand the concept for services provided by WCF services. WCF services provided two kind of services.
1) SOAP based services.
2) Rest based services - Replaced by Web API now (but still supported by WCF, if you want to develop rest based services use Web API instead)
First time when you followed the tutorial, you built SOAP based services and you are able to consume the service from your console application as console based application that are .net based does have necessary tools that support SOAP based services.
Second time when you are trying to consume services you are trying to consume services that are rest based as Javascript (ExtJs in this case) doesn't support consuming SOAP based services. At least I haven't came across any javascript framework that is capable of consuming SOAP based services from browser to its full extent.
So you should be developing REST based services, if you want to consume those services from web browser (Ext js in this case)
There are few things you need to change within your code to accomplish so
namespace Mobile.Service.Maintenance
{
[ServiceContract]
interface IHelloWorldService
{
[OperationContract]
[WebGet(BodyStyle = WebMessageBodyStyle.Wrapped,
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json
)]
String GetMessage();
}
}
Change your web.config so that it you are trying to provide WCF Restful services
Add following endpoint behavior under behavior section in web.config
<endpointBehaviors>
<behavior name="restfulbehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
Add following endpoint behavior
<services>
<service name="Mobile.Service.Maintenance.HelloWorldService">
<endpoint address="" behaviorConfiguration="restfulbehavior"
binding="webHttpBinding"
bindingConfiguration=""
contract="Mobile.Service.Maintenance.IHelloWorldService"/>
</service>
</services>
Trying running the service using your browser first.
localhost:57044/www/HelloWorldService.svc/GetMessage
if it browser display hello world from bars, congratulation you have your first restful web based services.
stackoverflow didn't let me post image, add configuration under <system.servicemodel>
an excellent article for restful services can be found here
http://www.codeproject.com/Articles/571813/A-Beginners-Tutorial-on-Creating-WCF-REST-Services
Hope this helps
Thank you