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>
這裏是看看你是否真的感興趣的源代碼。
謝謝。
謝謝。如你所述,在我做了修改之後它就起作用了。再次感謝給我更多細節。它們對我來說非常重要。 –