Итак, я пытаюсь создать службу отдыха, но получаю сообщение об ошибке:
Если я пытаюсь запустить его в браузере, я получаю: The type 'WcfService2.Service1', provided as the Service attribute value in the ServiceHost directive could not be found.
namespace WcfService2
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
[ServiceContract]
public class HelloWorldService
{
[OperationContract]
[WebGet(UriTemplate = "")]
public string HelloWorld()
{
return "Hello world!";
}
}
}
namespace WcfService2
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
class Program
{
static void Main(string[] args)
{
WebHttpBinding binding = new WebHttpBinding();
WebServiceHost host =
new WebServiceHost(typeof(HelloWorldService));
host.AddServiceEndpoint(typeof(HelloWorldService),
binding,
"http://localhost:8000/Hello");
host.Open();
Console.WriteLine("Hello world service");
Console.WriteLine("Press <RETURN> to end service");
Console.ReadLine();
}
}
}