2012-08-10 87 views
0

我有一個使用MSMQ的WCF服務,託管在IIS中。該服務不會啓動並從隊列中讀取消息,直到服務的SVC頁面的URL在瀏覽器中被點擊,這在部署和應用程序池回收之後會出現問題。要解決這一點,我安裝了IIS Application Initialization module將發送假的請求,在Web.config像這樣指定的頁面:IIS應用程序初始化模塊將請求發送到本地主機

<system.webServer> 
    <applicationInitialization remapManagedRequestsTo="Startup.htm" skipManagedModules="true" > 
    <add initializationPage="/MyService.svc" /> 
    </applicationInitialization> 
</system.webServer> 

我遇到的問題是,它的打本地主機時,我的網站被綁定到另一個域名,所以我看到這個錯誤:

WebHost failed to process a request. Sender Information: System.ServiceModel.Activation.HostedHttpRequestAsyncResult/42715336 Exception: System.ServiceModel.ServiceActivationException: No protocol binding matches the given address 'http://localhost/MyService.svc'. Protocol bindings are configured at the Site level in IIS or WAS configuration. ---> System.InvalidOperationException: No protocol binding matches the given address 'http://localhost/MyService.svc'. Protocol bindings are configured at the Site level in IIS or WAS configuration.

任何想法如何解決這個問題?

+0

不要在IIS中託管MSMQ端點? – 2012-08-10 14:40:26

+1

@hugh Yep謝謝你。 – Charlie 2012-08-10 15:09:58

回答

0

我已經完成了SVN服務連接到EMS服務器,所以它應該工作。如果它沒有創建一個ASPX頁面,可以執行一些類似followign的操作,甚至可以執行您的服務。

<%@ Page aspcompat=true Language="VBScript" %> 


Dim objSvrHTTP 
Dim PostData 
Dim WebName 
Dim SoapAction 
    SoapAction = "Your Soap Action" 

WebName = Request.URL.Host & ":" & Request.URL.Port 


objSvrHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP") 
PostData = "Soap Post XML (Recoreded probably)" 

objSvrHTTP.open("POST", "http://" & WebName & "/path/SVCFile.svc", false) 
objSvrHTTP.setRequestHeader("Content-Type", "text/xml") 
' set SOAPAction as appropriate for the operation ' 
objSvrHTTP.setRequestHeader("SOAPAction", SoapAction) 

objSvrHTTP.Send(cstr(PostData)) 

dim serviceResponse 
dim ExpectedResponse 
    ExpectedResponse = "asdf" 
serviceResponse = objSvrHTTP.responseText 

if (serviceResponse <> ExpectedResponse) then 
    Response.Write("The Service Didn't return false and should have. it returned: ") 
    Response.Write(serviceResponse) 
else 
    Response.Write("OK") 
end if 
相關問題