I have an application I built in c# back in 2011 that has a WCFServer:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
namespace Atlantic_Client
{
[ServiceContract]
public interface IDataRequest
{
[OperationContract]
string query(string instr, string attr);
}
public class DataRequest : IDataRequest
{
public string query(string symbol, string attr)
{
if (attr == "test")
{
try
{
return 55;
}
catch (Exception) { }
return 55;
}
else
{
return "Bad Attribute";
}
return "UNKNOWN";
}
}
}
class WCFServer
{
ServiceHost host = null;
public void open()
{
host = new ServiceHost(
typeof(DataRequest),
new Uri[]{
new Uri("net.pipe://localhost")
});
host.AddServiceEndpoint(typeof(IDataRequest),
new NetNamedPipeBinding(),
"DataRequest");
try
{
host.Open();
}
catch (AddressAlreadyInUseException) { }
}
public void close()
{
try
{
host.Close();
}
catch (CommunicationObjectFaultedException) { }
}
}
}
This class is working perfectly on my old computer with Visual Basic 2008 (I just run the program as a Debug each time rather than a standalone app) and Excel 2007.
However, I got a new computer, installed Visual Studio 2008 and Excel 2010, and when I try the same thing, it doesn't work at all.
The excel RTD cells just return #N/A