【发布时间】:2018-02-01 12:38:54
【问题描述】:
我有一个与 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 运行。
标签: c# asp.net .net wcf iis-10