The above will not work in case you do not specify a correct contract naming in your web.config.
In case your class without an interface is in the following namespace:
namespace Foo
{
[ServiceContract(Namespace="http://kennyw.com/WCFservices/")]
[WebService(Namespace="http://kennyw.com/sampleservices/")]
public class MyService : System.Web.Services.WebService
{
[WebMethod]
[OperationContract]
public string Hello(string name)
{
return string.Format(“Hello {0}.”, name);
}
}
}
In this case the web config service configuration should look like
<services>
<service name="YourServiceName">
<endpoint address="" behaviorConfiguration="httpBehavior" binding="webHttpBinding" contract="Foo.MyService"/>
</service>
</services>