2

I have a WCF service running in an ASP.Net application. The svc file internals looks like this:

<%@ ServiceHost Language="C#" Debug="true" Service="my.api.Awesomeapi" Factory="my.api.AwesomeHostFactory" %>

The factory code-behind also lives in the ASP.Net application and is as follows:

namespace my.api
{
    /// <summary>
    /// Custom Service Factory class for Awesome Web Service
    /// </summary>
    public class AwesomeHostFactory : ServiceHostFactory
    {
        private const string CONST_DEFAULT_ADDRESS = "http://localhost/api/Awesomeapi.svc";
        private static readonly string m_sBaseAddress = my.Utilities.GetAppConfigSetting("AwesomeAPIBaseAddress", CONST_DEFAULT_ADDRESS, true);

    protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
    {
        ServiceHost AwesomeAPIServiceHost = null;
        Uri oURI = new Uri(m_sBaseAddress);           
        AwesomeAPIServiceHost = new ServiceHost(serviceType, oURI);          
        return AwesomeAPIServiceHost;
    }

}
}

The service works fine, however when I attach to the w3wp.exe process in Visual Studio 2010 and set a breakpoint in the CreateServiceHost method and go to the localhost URL listed above for the first time, my breakpoint circle turns hollow (indicating unreachable code) then the service runs and displays the generic "You have created a service" message, and then the breakpoint reverts to its normal red icon. Would anyone know what's happening here?

4

0 回答 0