2
我是WCF的新手,我正在通过创建示例应用程序进行自学。这是一个非常简单的应用程序,它抛出一个异常形式以下线,注释'System.ServiceModel.Diagnostics.TraceUtility'在WCF中抛出一个异常
namespace ConsoleAppHost
{
class Program
{
public static void Main()
{
//Exception thorwing from following line
using (ServiceHost host = new ServiceHost(typeof(ReportService.ReportService))) //Exception thorwn from this
{
host.Open();
Console.WriteLine("Host started @ " + DateTime.Now.ToShortDateString());
Console.ReadLine();
}
}
}
}
这里是我的主机app.config文件(同一个控制台应用程序)下打下了代码。请向我表明问题在哪里?
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="mexBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<services>
<service name="ReportService.ReportService" behaviorConfiguration="mexBehavior">
<endpoint address="ReportService" binding="netTcpBinding" bindingconfiguration="" contract="ReportService.IReportService"></endpoint>
<host>
<baseAddresses>
<add baseAddress ="http://localhost:8080/"/>
<add baseAddress ="net.tcp://localhost:8090/"/>
</baseAddresses>
</host>
</service>
</services>
</configuration>
这里是看看你是否真的感兴趣的源代码。
谢谢。
谢谢。如你所述,在我做了修改之后它就起作用了。再次感谢给我更多细节。它们对我来说非常重要。 –