【发布时间】:2022-01-07 02:42:15
【问题描述】:
我目前正在将一个 winforms 应用程序迁移到 WPF,我需要做的最后一件事是迁移 WCF 服务
配置文件发送方:
<behaviors>
<serviceBehaviors>
<behavior name="NetPipeBehavior">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="True" httpHelpPageEnabled="True" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="MyLibrary.WcfServiceController.GuiController" behaviorConfiguration="NetPipeBehavior">
<endpoint address="" binding="netNamedPipeBinding" contract="MyLibrary.WcfServiceController.IGuiController" />
<endpoint address="mex" binding="mexNamedPipeBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.pipe://localhost/GUI-ORG/" />
</baseAddresses>
</host>
</service>
</services>
客户端:
<bindings>
<netNamedPipeBinding>
<binding name="NetNamedPipeBinding_IGuiController"/>
</netNamedPipeBinding>
</bindings>
<client>
<endpoint address="net.pipe://localhost/GUI-ORG/" binding="netNamedPipeBinding"
bindingConfiguration="NetNamedPipeBinding_IGuiController"
contract="GuiUpdaterReference.IGuiController" name="NetNamedPipeBinding_IGuiController">
</endpoint>
</client>
我有一个看起来像这样的包装器:
public class GuiControllerClientWrapper
{
private readonly LaunchType _launchType;
private readonly GuiUpdaterReference.IGuiController _gc;
public GuiControllerClientWrapper(LaunchType launchType)
{
_errorSent = false;
_launchType = launchType;
_gc = new GuiControllerClient();
if (launchType == LaunchType.Manual)
{
((GuiControllerClient)_gc).Open();
}
}
/* other functions */
}
调用Open()时出现异常:EndpointNotFoundException: There was no endpoint listening at "net.pipe://localhost/GUI-ORG" that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
InnerException 如下:The pipe endpoint 'net.pipe://localhost/GUI-ORG' could not be found on your local machine
然后一个堆栈跟踪指向我的包装器调用打开函数
问题是,如果我在项目中添加旧的 winforms GUI 并重新安装所有内容,它确实可以工作,发送消息并且一切正常
我试过了
- 使用诊断,但它没有提供任何我可以使用的信息
- 更改地址
- 重新创建/更新服务引用
我错过了什么?
【问题讨论】: