Hi,
Is it possible to create a single .svc file (WCF Service) that I can upload to my server and test if it correctly handles WCF files? i.e. it is configured to host WCF services.
(I have a IIS6 box that I have to test)
Hi,
Is it possible to create a single .svc file (WCF Service) that I can upload to my server and test if it correctly handles WCF files? i.e. it is configured to host WCF services.
(I have a IIS6 box that I have to test)
You can use inline coding in your svc file:
%@ ServiceHost Language="C#" Debug="true" Service="MyService.MyService" %>
using System;
using System.Runtime.Serialization;
using System.ServiceModel;
namespace MyService
{
[ServiceContract]
public interface IMyService
{
[OperationContract]
int MyMethod(int x, int y);
}
public class MyService : IMyService
{
public int MyMethod(int x, int y)
{
return ((x + y) * 2);
}
}
}
But you will need also a web.config file and a virtual directory configured on your web server:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="false" />
</system.web>
<system.serviceModel>
<services>
<service name="MyService.MyService">
<endpoint address="" binding="wsHttpBinding" contract="MyService.IMyService" />
</service>
</services>
</system.serviceModel>
</configuration>
But basically if your web server has IIS 6.0 and .NET 3.0 installed then you should have no problems running WCF services on it.