2011-11-15 57 views
0

我一直在WAS下實現NetTcp綁定和元數據方面取得了成功,但是我在WAS/IIS下的netMsmqBinding存在問題。簡而言之,我可以將MEX實施爲自託管的NetMsmq綁定應用程序,但不適用於WAS/IIS。看起來WAS拒絕使用我自己託管的應用程序中的任何地址的地址。換句話說,我可以在自託管做到這一點:WCF - 無法生成元數據/實施MEX NetMsmq綁定IIS下?

<system.serviceModel> 
    <services> 
     <service name="Microsoft.Samples.MSMQTransactedSample.OrderProcessorService" behaviorConfiguration="OrderProcessorServiceBehavior"> 
     <host> 
      <baseAddresses> 
      <add baseAddress="http://localhost:8000/ServiceModelSamples/service" /> 
      </baseAddresses> 
     </host> 
     <!-- Define NetMsmqEndpoint --> 
     <endpoint address="net.msmq://localhost/private/ServiceModelSamplesTransacted" binding="netMsmqBinding" bindingConfiguration="TransactedBinding" contract="Microsoft.Samples.MSMQTransactedSample.IOrderProcessor" /> 
     <!-- the mex endpoint is exposed at http://localhost:8000/ServiceModelSamples/service/mex --> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="OrderProcessorServiceBehavior"> 
      <serviceMetadata httpGetEnabled="True" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <bindings> 
     <netMsmqBinding> 
     <binding name="TransactedBinding"> 
      <security mode="None" /> 
     </binding> 
     </netMsmqBinding> 
    </bindings> 
    </system.serviceModel> 

Hoever,當我嘗試類似的東西在WAS,它說沒有終點lisening地址8000它不會舉辦metdata。有人可以幫助我獲取元數據或在WAS中爲NetMsmq實施MEX:

<system.serviceModel> 
    <bindings> 
     <netMsmqBinding> 
     <binding name="MsmqBindingNonTransactionalNoSecurity" exactlyOnce="false"> 
      <security mode="None"/> 
     </binding> 
     </netMsmqBinding> 
    </bindings> 
    <services> 
     <service name="Portal.LoadSim.Services.MsmqService" behaviorConfiguration="PortalServiceBehavior"> 
     <host> 
      <baseAddresses> 
      <add baseAddress="http://localhost:8000/PortalLoadSimServices10/MsmqService"/> 
      </baseAddresses> 
     </host> 
     <!-- Define NetMsmqEndpoint --> 
     <endpoint address="net.msmq://localhost/private/PortalLoadSimServices10/MsmqService.svc" binding="netMsmqBinding" bindingConfiguration="MsmqBindingNonTransactionalNoSecurity" contract="Portal.LoadSim.Shared.IMsmqService" /> 
     <!-- the mex endpoint is exposed at http://localhost:8000/PortalLoadSimServices10/MsmqService/mex --> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 

     </service> 

    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="PortalServiceBehavior"> 
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
      <serviceMetadata httpGetEnabled="true"/> 
      <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
      <serviceDebug includeExceptionDetailInFaults="false" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    </system.serviceModel> 

回答

0

您需要爲您的服務添加URL訪問控制。這個命令應該爲你工作:

netsh http add urlacl url=http://localhost:8000/PortalLoadSimServices10/MsmqService user="NT AUTHORITY\NetworkService" listen=yes 

要刪除的條目

delete urlacl url=http://localhost:8000/PortalLoadSimServices10/MsmqService 

HTH

UPDATE:這不是前面回答您的問題。如果您希望將這些服務作爲自託管應用程序運行並在非標準帳戶下運行,那麼您將執行此操作。對不起,我把它弄混了。我嘗試在家中的示例應用程序上使用您的配置,發現我必須做兩件事情才能使其運行 - 其一,我必須將隊列重命名爲svc文件的路徑和名稱(例如,PortalLoadSimServices10/MsmqService.svc)而不是使用基地址,只需瀏覽IIS主機應用程序中的svc文件即可。您可能還需要修改隊列權限,以便iis可以正確訪問它。讓我知道這是否解決了你的問題。

+0

相同的錯誤 - 下載'http:// localhost:8000/PortalLoadSimServices10/MsmqService/mex /'時出錯無法連接到遠程服務器由於目標機器主動拒絕它,因此無法建立連接127.0.0.1 :8000。在http:// localhost:8000/PortalLoadSimServices10/MsmqService/mex /上沒有可以接受消息的端點。這通常是由不正確的地址或SOAP操作引起的。有關更多詳細信息,請參閱InnerException(如果存在)。 –

+0

我嘗試將服務引用添加到http:// localhost:8000/PortalLoadSimServices10/MsmqService/mex –

+0

刪除urlacl條目並嘗試將完整地址添加到您的元數據,包括mex(這不在我放入帖子的命令中)。 – stephenl