Hello experts!
I am trying to get my head around example I found on internet.
I am trying to re- create the example of simple service I found on internet.
This is what I do:
1. VS2005 Pro -> new project -> class library
2. I have three files my service consists from:
A.
*** DataContract.cs***
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace SampleService
{
[DataContract]
public class Request
{
string name;
[DataMember]
public string Name
{
get { return name; }
set { name = value; }
}
}
[DataContract]
public class Response
{
string message;
[DataMember]
public string Message
{
get { return message; }
set { message = value; }
}
}
}
B.
***Service.cs***
using System;
using System.Collections.Generic;
using System.ServiceModel;
namespace SampleService
{
[ServiceBehavior]
public class Service: ISampleService
{
[OperationBehavior]
public Response GetMessage
(
Request request
)
{
Response response = new Response();
if ( null == request )
{
response.Message = "Error!";
}
else
{
//set the message
response.Message = "Hello, " + request.Name;
}
return response;
}
[OperationBehavior]
public string SayHello()
{
return "Hello, World!";
}
}
}
C.
***ServiceContract.cs***
using System;
using System.ServiceModel;
namespace SampleService
{
[ServiceContract]
public interface ISampleService
{
[OperationContract]
Response GetMessage
(
Request request
);
[OperationContract]
string SayHello();
}
}
I understand that I need service.svc file, so I have it:
***Service.svc***
<% @ServiceHost
Language=C#
Service="SampleService.Service"
%>
Questions:
1. How can I configure VS to create Web.Config file automatically when I build my service and put it into selected folder?
Thank you
panJames
ASKER
Thank you
panJames