I trying to use VS2010 WCF Service Application template to create a new WCF service. After editing the default service contract and updating the implementation of this this contract I tried to run the service from within VS (F5).
The WCF Test Client starts and throws and error while trying to add my service.
Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.
I have not made and changes to the web.config. I am having the same problem posted here.
However, unlike the other posting, my service contract is an interface. Can someone tell me what I am doing wrong?
Thanks!
CheckIn.svc
using System;
using System.IO;
namespace org.myorg.pkggateway
{
public class PackageCheckIn : IPackageCheckIn
{
public bool CheckIn(int value)
{
try
{
StreamWriter sw = new StreamWriter("test.txt", true);
sw.WriteLine(value.ToString());
sw.Close();
}
catch(Exception e)
{
return false;
}
return true;
}
}
}
IPackageCheckIn.cs:
using System.Runtime.Serialization;
using System.ServiceModel;
namespace org.myorg.pkggateway {
[ServiceContract]
public interface IPackageCheckIn
{
[OperationContract]
bool CheckIn(int value);
}
}
Web.config (unchanged from autogen):
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
update
It seems that when I renamed the default .svc file that the template creates refactor did not rename this file everywhere. There must be a reference to it somewhere else. However when I search my entire solution for use of "Service1.svc" it does not exist anywhere. Does anyone know how to clean this up? I even did a search on the file system for a file containing this filename and came up with nothing. I cannot find where VS is still referencing this .svc file. Anyone have this problem?
I have deleted the service altogether and created a new one and the problem still persists.
update
When I run my solution the WCF test client fails to load the deleted service. However the one that does exist works fine. I guess I just have to ignore the fact that I cannot get the test client to "forget" about this service.