我有一個簡單的託管WCF服務與ASP.NET並排,並有困難的時間調試/步入到服務。以下是這些文件。提前致謝!如何調試與ASP.NET並列託管WCF服務
的Web.config
<system.web>
<compilation debug="true" targetFramework="4.5.2"/>
<httpRuntime targetFramework="4.5.2"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="mexBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
<service name="WCF_TestService.TestService" behaviorConfiguration="mexBehavior">
<endpoint address="" binding="basicHttpBinding" contract="WCF_TestService.ITestService"></endpoint>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
ITestService.cs
namespace WCF_TestService
{
[ServiceContract]
public interface ITestService
{
[OperationContract]
string GetMessage(string name);
}
}
TestService.svc.cs
的斷點設置在return
和提示消息是The breakpoint will not currently be hit. No symbols have been loaded for this document
namespace WCF_TestService
{
public class TestService : ITestService
{
public string GetMessage(string name)
{
return $"Hello {name}";
}
}
}
客戶
客戶端是控制檯應用程序。
namespace Client
{
class Program
{
static void Main(string[] args)
{
ServiceProxy.TestServiceClient client = new ServiceProxy.TestServiceClient();
Console.WriteLine(client.GetMessage("John Smith"));
Console.ReadLine();
}
}
}
項目是否包含在同一個解決方案中? WCF服務是通過IIS運行還是自託管? –
@TravisActon他們在同一個解決方案中。它通過IIS10運行。 –