我使用VS2008和.NET 3.5。如何在IIS 5.1中託管WCF服務?
這是我的情況:
1)外部服務:
我使用外部服務(沒有關於它的任何代碼的知識;它是黑盒子對我來說),並調用它的方法,它有幾個參數。其中之一是我應該寫的WCF服務地址(見2))。通話看起來如下:
string Url = "http://public-ip:8072/Service.svc";
string content = extClient.Method1(Url, email, param1, param2...);
在方法1的身體的某個地方,他們稱我從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地址。也許我犯了錯誤。我不確定。
與論壇網站不同,我們不使用「謝謝」或「任何幫助表示讚賞」,或對[so]進行簽名。請參閱「[應該'嗨','謝謝',標語和致敬從帖子中刪除?](http://meta.stackexchange.com/questions/2950/should-hi-thanks-taglines-and-salutations-be –
好吧,我明白了 – tesicg