私はWCFサービスを作成し、コンソール経由でホストしました。 「net.tcp://192.0.0.0:9100/ConsoleApplication3/Communicatorを私は別のWebアプリケーションを作成し、サービス参照にそれを追加するために、その所与のエラーを試してみましたコンソール経由でのWCFサービスのホスト
ときにはメタデータは は解決できないというの参照が含まれています.svc/mextcp '。 net.tcp://192.0.0.0:9100/ConsoleApplication3/Communicator.svc/mextcpに接続できませんでした。 接続の試行は、 00:00:00.9843750の時間間隔で続きました。 TCP エラーコード10061:ターゲットマシン が積極的に192.0.0.0:9100を拒否したため、接続できませんでした。 ターゲットマシンが積極的に拒否したため接続できません 192.0.0.0:9100サービスが現在のソリューションで定義されている場合は、 サービスを再構築し、 サービス参照を再度追加してください。ここで
コードです:
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
try
{
using (ServiceHost host = new ServiceHost(typeof(Communicator)))
{
host.Open();
Console.WriteLine("Press <Enter> to terminate the Host application.");
Console.ReadLine();
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.ReadLine();
}
}
}
[ServiceContract]
public interface ICommunicator
{
[OperationContract]
string SayHello();
}
public class Communicator : ICommunicator
{
public string SayHello()
{
return "I am here";
}
}
そして、ここでは、コンフィギュレーションです:
<configuration>
<system.serviceModel>
<services>
<service name="ConsoleApplication3.Communicator" behaviorConfiguration="CommunicatorBehavior">
<!-- Service Endpoints -->
<endpoint address="ConsoleApplication3" binding="netTcpBinding"
contract="ConsoleApplication3.ICommunicator"/>
<!-- This Endpoint is used for genertaing the proxy for the client -->
<!-- To avoid disclosing metadata information, set the value below to false and
remove the metadata endpoint above before deployment -->
<endpoint address="mex" contract="IMetadataExchange" binding="mexTcpBinding" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9100/"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="CommunicatorBehavior">
<serviceMetadata httpGetEnabled="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
私は 'net.tcp:// localhost:9100/mex 'を試しましたが、それでも同じerrrorを試したアドレス – BreakHead
@BreakHead:これはあなたが最終的に行っているようです: 'net.tcp://192.168.168。145:9100/' –
Thanxしかし、それでも同じエラー:( – BreakHead