私は本当に奇妙な問題に遭遇しました。私は、各アプリ インスタンスが WCF サービスのホストおよび/またはクライアントのいずれか (非常に p2p に似ている) になることができる、高度に分散されたアプリケーションを構築しています。クライアントと対象のホスト(現在、すべてが単一のコンピューターで実行されているため(ファイアウォールの問題などがないため)、ホストではなくアプリを意味します)が同じでない限り、すべてが正常に機能します。それらが同じである場合、アプリはちょうど 1 分間ハングしてから、TimeoutException をスローします。WCF-Logging は、役立つものを何も生成しませんでした。問題を示す小さなアプリを次に示します。
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
var binding = new NetTcpBinding();
var baseAddress = new Uri(@"net.tcp://localhost:4000/Test");
ServiceHost host = new ServiceHost(typeof(TestService), baseAddress);
host.AddServiceEndpoint(typeof(ITestService), binding, baseAddress);
var debug = host.Description.Behaviors.Find<ServiceDebugBehavior>();
if (debug == null)
host.Description.Behaviors.Add(new ServiceDebugBehavior { IncludeExceptionDetailInFaults = true });
else
debug.IncludeExceptionDetailInFaults = true;
host.Open();
var clientBinding = new NetTcpBinding();
var testProxy = new TestProxy(clientBinding, new EndpointAddress(baseAddress));
testProxy.Test();
}
}
[ServiceContract]
public interface ITestService
{
[OperationContract]
void Test();
}
public class TestService : ITestService
{
public void Test()
{
MessageBox.Show("foo");
}
}
public class TestProxy : ClientBase<ITestService>, ITestService
{
public TestProxy(NetTcpBinding binding, EndpointAddress remoteAddress) :
base(binding, remoteAddress) { }
public void Test()
{
Channel.Test();
}
}
私は何を間違っていますか?
よろしく、Pharao2k