【发布时间】:2012-12-11 12:16:04
【问题描述】:
我使用 VS2008 和 .NET 3.5。
这是我的情况:
1) 外部服务:
我使用外部服务(对其代码一无所知;对我来说它是黑匣子)并调用它的方法,该方法需要几个参数。其中之一是我应该写的 WCF 服务的地址(见 2))。调用如下所示:
string Url = "http://public-ip:8072/Service.svc";
string content = extClient.Method1(Url, email, param1, param2...);
在 Method1 的某个地方,他们从 2) 调用我的服务。
2) 我的服务:
public class Service : IService
{
public const string ReplyAction = "http://public-ip:8072/Message_ReplyAction";
public const string RequestAction = "http://public-ip:8072/Message_RequestAction";
public Message SetData(Message requestXml)
{
// Do something
}
}
Web.config:
<system.serviceModel>
<serviceHostingEnvironment>
<baseAddressPrefixFilters>
<add prefix="http://public-ip:8072/"/>
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
<behaviors>
<serviceBehaviors>
<behavior name="Parus.ServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpGetUrl="http://local-ip:8072/Service.svc"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="Parus.ServiceBehavior" name="Parus.Service">
<endpoint address="http://public-ip:8072/Service.svc" binding="basicHttpBinding" contract="Parus.IService">
</endpoint>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
</service>
</services>
</system.serviceModel>
当我在本地使用我的服务时,它可以工作,但当我将它暴露给全世界时,它就不行了。我的意思是 1) 中的 Method1 根本不调用它。我尝试了不同的事情,但到目前为止没有任何反应。防火墙关闭时它不起作用。另外,添加防火墙的8072端口例外时也不起作用。
我想我在 Web.config 文件中做错了什么或错过了 IIS 中的一些设置。您可以关注 Web.config 文件中的 public-ip 和 local-ip 地址。也许我对他们犯了错误。我不确定。
【问题讨论】:
-
与论坛网站不同,我们不使用“谢谢”、“任何帮助表示赞赏”或Stack Overflow 上的签名。请参阅“Should 'Hi', 'thanks,' taglines, and salutations be removed from posts?.
标签: wcf iis deployment