我有一個自託管的API在端口8080上運行。在端口80上是我的網站服務器(IIS 7.5),我的網站無法訪問。我添加了一個應用程序「MyApiTestsite」。現在,所有的請求/ API /或/ signalr /我想轉發到端口8080:IIS:URL Rewrite/signalr /和/ api /到端口8080
http://mycompany/MyApiTestsite -> untouched
http://mycompany/MyApiTestsite/signalr/* -> http://mycompany:8080/signalr/*
http://mycompany/MyApiTestsite/api/* -> http://mycompany:8080/api/*
我已經安裝ARR
(這是必要的,甚至?)和URL Rewrite
。
這裏是我的規則我迄今(對SignalR):
<rule name="Rewrite SignalR to port 8080" patternSyntax="Wildcard" stopProcessing="true">
<match url="signalr/*" />
<serverVariables>
<set name="SERVER_PORT" value="8080" />
</serverVariables>
<action type="Rewrite" url="{R:0}" appendQueryString="true" logRewrittenUrl="false" />
</rule>
我查了日誌文件和規則將匹配。然而,這並不在所有的工作:
- 我不知道如何擺脫RelativePath(我的應用程序)
MyApiTestsite
- 如果我檢查日誌的端口沒有被替換
登錄:
RULE_EVALUATION_END RuleName="Rewrite SignalR to port 8080", RequestURL="MyApiTestsite/signalr/hubs", QueryString="", StopProcessing="true", Succeeded="true"
URL_REWRITE_END RequestURL="/MyApiTestsite/signalr/hubs"
GENERAL_CHILD_REQUEST_START SiteId="4", RequestURL="http://mycompany:80/MyApiTestsite/signalr/hubs", RequestVerb="GET", RecursiveLevel="1"
更新: 我現在根據this PO試了一下ST。但是,它仍然不起作用。該網址似乎不錯,但在MvcHandler接管並返回404:
URL_REWRITE_END RequestURL = 「HTTP:// myCompany中:8080/signalr /集線器」
USER_SET =進行AuthType 「」,用戶名= 「」 ,SupportsIsInRole = 「真」
HANDLER_CHANGED
OldHandlerName = 「ExtensionlessUrlHandler集成-4.0」, NewHandlerName = 「System.Web.Mvc.MvcHandler」, NewHandlerModules = 「ManagedPipelineHandler」, NewHandlerScriptProcessor = 「」, NewHan dlerType = 「System.Web.Mvc.MvcHandler,System.Web.Mvc, 版本= 5.1.0.0」GENERAL_SEND_CUSTOM_ERROR的HTTPStatus = 「404」,HttpSubStatus = 「4」, FileNameOrURL = 「404.htm」
更新2:
這裏是我想要做一個圖片...
更新3 這次我試着用Server Farms
代替。
ARR_WEBFARM_ROUTED WebFarm="mycompany API", Algorithm="LeastRequests"
HANDLER_CHANGED OldHandlerName="", NewHandlerName="ApplicationRequestRoutingHandler", NewHandlerModules="ApplicationRequestRouting", NewHandlerScriptProcessor="", NewHandlerType=""
ARR_SERVER_ROUTED RoutingReason="LoadBalancing", Server="mycompany", State="Active", TotalRequests="1", FailedRequests="0", CurrentRequests="1", BytesSent="0", BytesReceived="0", ResponseTime="0"
GENERAL_SET_REQUEST_HEADER HeaderName="Max-Forwards", HeaderValue="10", Replace="true"
GENERAL_SET_REQUEST_HEADER HeaderName="X-Forwarded-For", HeaderValue="xxx.xx.xx.xxx:52327", Replace="true"
GENERAL_SET_REQUEST_HEADER HeaderName="X-ARR-SSL", HeaderValue="", Replace="true"
GENERAL_SET_REQUEST_HEADER HeaderName="X-ARR-ClientCert", HeaderValue="", Replace="true"
GENERAL_SET_REQUEST_HEADER HeaderName="X-ARR-LOG-ID", HeaderValue="f8exxxc2-7a6d-4cf6-a3c6-ecde245a0d80", Replace="true"
GENERAL_SET_REQUEST_HEADER HeaderName="Connection", HeaderValue="", Replace="true"
//>>>>>now it gets changed back!!! Why????<<<<<<
URL_CHANGED OldUrl="http://mycompany API/signalr/hubs", NewUrl="/MyApiTestsite/signalr/hubs"
是correcyly配置你的IIS?請參閱http://www.asp.net/signalr/overview/signalr-20/getting-started-with-signalr-20/supported-platforms以獲取確切說明 –
讓我們這樣說:如果我硬編碼API/SignalR訪問在端口8080上並使用CORS,然後一切按預期工作。但是,我想隱藏用戶的這些信息。 – Dunken
ARR不應該是必需的,只是URL重寫。 –