Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/273.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 配置WCF主机服务_C#_Wcf_Web Services_Host - Fatal编程技术网

C# 配置WCF主机服务

C# 配置WCF主机服务,c#,wcf,web-services,host,C#,Wcf,Web Services,Host,我有一个关于Host app.config文件配置的基本问题 假设我在pc上托管WCF服务,其IP为:123.456.789.001:9999 这是我的app.config文件: <configuration> 我想知道应该在baseAddress和httpGetUrl中插入哪些正确的参数。我很困惑。我应该在那里放“localhost”还是ip(123.456.789.001)?我相信您会使用ip地址作为端点,使用WSDL作为httpGetUrl: <baseA

我有一个关于Host app.config文件配置的基本问题

假设我在pc上托管WCF服务,其IP为:123.456.789.001:9999

这是我的app.config文件:

<configuration>



我想知道应该在baseAddress和httpGetUrl中插入哪些正确的参数。我很困惑。我应该在那里放“localhost”还是ip(123.456.789.001)?

我相信您会使用ip地址作为端点,使用WSDL作为httpGetUrl:

<baseAddresses>         
  <add baseAddress="http://123.456.789.001:9999/MyWebexService"/>
</baseAddresses> 

<behavior name="MyServiceTypeBehaviors" >         
  <serviceDebug includeExceptionDetailInFaults="true"/>     
  <serviceMetadata httpGetEnabled="true" httpGetUrl="http://123.456.789.001:9999/MyWebexService?wsdl"/>        
</behavior>    


我不认为这样做是正确的:Q:在排队的应用程序上调用ServiceHost.Open()会引发以下异常:System.ArgumentException:基址不能包含URI查询字符串。为什么?答:检查配置文件和代码中的队列URI。虽然MSMQ队列支持使用“?”字符,但URI将此字符解释为字符串查询的开头。要避免此问题,请使用不包含“?”字符的队列名称。第一个问题-您是否使用MsmqBinding?如果是,为什么要使用http:作为地址的协议?那么我上面所说的应该是有效的-您发布的评论似乎是特定于NetMsmqBinding的。你试过我的答案吗?如果它不起作用,它会给你任何错误吗?
<baseAddresses>         
  <add baseAddress="http://123.456.789.001:9999/MyWebexService"/>
</baseAddresses> 

<behavior name="MyServiceTypeBehaviors" >         
  <serviceDebug includeExceptionDetailInFaults="true"/>     
  <serviceMetadata httpGetEnabled="true" httpGetUrl="http://123.456.789.001:9999/MyWebexService?wsdl"/>        
</behavior>