回答

1

配置Azure的應用程序服務沒有公衆的URL

據我所知,我們不能沒有公共URL配置Azure的應用服務。如果您創建了一個Web應用程序,它將自動提供公共端點供用戶訪問。

這裏有兩個解決方法。

我發現github應用程序只是使用web應用程序的webjobs。

方式一:

如果您不需要任何網站,只需使用backgourd進程來運行webjobs,您可以選擇azure function它採用WebJobs SDK本身,但不需要應用服務進行配置爲了它。

方式二:

通常我們運行在Azure的應用程序服務的Web應用程序WebJobs,並通過網址Azure的應用程序服務的Web應用程序可以訪問/瀏覽。如果要阻止用戶瀏覽到該Azure App Service Web應用程序,則可以將重寫規則添加到站點的web.config中,以便block web access

web.config中是這樣的:

<?xml version="1.0" encoding="utf-8"?> 
<!-- 
    For more information on how to configure your ASP.NET application, please visit 
    https://go.microsoft.com/fwlink/?LinkId=169433 
    --> 
<configuration> 
    <system.webServer> 
    <rewrite> 
     <rules> 
     <rule name="Block unauthorized traffic to staging sites" stopProcessing="true"> 
      <match url=".*" /> 
      <conditions> 
      <!-- Enter your staging site host name here as the pattern--> 
      <add input="{HTTP_HOST}" pattern=".*" /> 
      <!-- Enter your white listed IP addresses --> 
      <add input="{REMOTE_ADDR}" pattern="123\.123\.123\.1" negate="true"/> 
      <!-- Add the white listed IP addresses with a new condition as seen below --> 
      <!-- <add input="{REMOTE_ADDR}" pattern="123\.123\.123\.2" negate="true"/> --> 

      </conditions> 
      <action type="CustomResponse" statusCode="403" statusReason="Forbidden" 
     statusDescription="Site is not accessible" /> 

     </rule> 

     </rules> 
    </rewrite> 
    </system.webServer> 

</configuration> 

更多有關如何在web.config添加到您的Web應用程序的詳細信息,您可以按照此步驟:

1.Open捻工具網絡門戶。

enter image description here

2.Open CMD控制檯並找到\網站\ wwwroot文件夾。

enter image description here

3.創建的web.config和複製的設置。

enter image description here

4.當我們訪問的網站,你會發現這一點:

enter image description here

+0

好吧,我得到了第二個解決方案使用的web.config工作。非常感謝您的解決方案! –

相關問題