Ich bin neu mit WCF. Ich erstelle WCF für serverseitige Druck-Szenario ... Ich host wcf dll auf der Konsole Anwendung. Unten ist mein Code:WCF unter Windows 7 warum nicht funktioniert.?
class Program
{
static void Main(string[] args)
{
using (ServiceHost host = new ServiceHost(typeof(PrintBarcode)))
{
host.Open();
Console.WriteLine("The service is ready...");
Console.WriteLine("Press <Enter> to stop the service.");
Console.ReadLine();
host.Close();
}
}
}
Und das ist mein app.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service behaviorConfiguration="CTIHandHeld.WCF.PrintBarcodeWcfServiceLibrary.Service1Behavior"
name="CTIHandHeld.WCF.PrintBarcodeWcfServiceLibrary.PrintBarcode">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="TcpBindingConfiguration"
contract="CTIHandHeld.WCF.PrintBarcodeWcfServiceLibrary.IPrintBarcode" />
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:3518/PrintBarcodeService" />
</baseAddresses>
</host>
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="TcpBindingConfiguration">
<security mode="Transport"/>
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="CTIHandHeld.WCF.PrintBarcodeWcfServiceLibrary.Service1Behavior">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
Dieser Code in Windows XP funktioniert .... Warum funktioniert es nicht, wenn ich es auf Windows 7? Ich führe es als Administrator und mit Firewall aus.
Das Dokument erscheint nur in der Druckwarteschlange und verschwindet ohne Warnung oder Fehler ... Aber Drucken nicht wirklich passieren.