2017-03-05 45 views
0

我想發佈一個測試網站到託管服務,我相信這是運行IIS 8.0。我使用了Visual Studio 2015 Build-> Publish並設置了一個ftp配置文件。已發佈的asp.net不斷要求登錄憑據

網站已發佈,但只有在我在根級別輸入憑據時纔有效。在我的配置文件中,我選擇了發佈版本,但問題在於我是否仍然使用Debug或Release。

我看着這個主題,但它沒有幫助。

IIS asking for log in credentials

由於網絡的網站上託管服務託管,我已經在IIS 8.0沒有控制權。這是可以遠程修復的東西嗎?

這裏是web.config文件:

<configuration> 
     <system.web> 
     <compilation targetFramework="4.5.2" /> 
     <httpRuntime targetFramework="4.5.2" /> 
     <httpModules> 
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" /> 
     </httpModules> 
     </system.web> 
     <system.codedom> 
     <compilers> 
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" /> 
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" /> 
     </compilers> 
     </system.codedom> 
     <system.webServer> 
     <validation validateIntegratedModeConfiguration="false" /> 
     <modules> 
      <remove name="ApplicationInsightsWebTracking" /> 
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" /> 
     </modules> 
     </system.webServer> 
     <appSettings> 
     <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" /> 
     </appSettings> 
    </configuration> 

的示例程序,這是非常簡單的只是渲染一個按鈕:

namespace testwebsite 
    { 
     public partial class Default : System.Web.UI.Page 
     { 
      protected void Page_Load(object sender, EventArgs e) 
      { 
       UnobtrusiveValidationMode = UnobtrusiveValidationMode.None; 

       string method = MethodInfo.GetCurrentMethod().ToString(); 
       Debug.WriteLine(method + "called!"); 
      } 

      protected void Clear_Click(object sender, EventArgs e) 
      { 
       string method = MethodInfo.GetCurrentMethod().ToString(); 
       Debug.WriteLine(method + "called!"); 
      } 
     } 
    } 

謝謝!

回答

0

只有我它得到的工作是這個部分從web.config中的託管公司原本在默認模板的網站複製(我改變了鑰匙,但它僅僅是漫長的AES密鑰)

<system.webServer> 
     <!--No sure why I have to have this--> 
     <security> 
      <authentication> 
      <!--How did this get generated?--> 
      <anonymousAuthentication password="[enc:AesProvider:3436xsIasdj8M264Fs73<somelengthykey>DFHDFGlrrh345YaOXmhpI=:enc]" /> 
      </authentication> 
     </security> 
     <validation validateIntegratedModeConfiguration="false"/> 
     ... 
    </system.webServer> 

但是,我不知道這個AesProvider密碼是如何產生的。任何人都知道這是否可以從asp控制面板生成?我仍然沒有看到方法。

謝謝。

0

通過更改Web配置將認證類型更改爲Anonymous Authentication

<configuration> 
    <system.web> 
     <authorization> 
     <allow users="?"/> 
     </authorization> 
    </system.web> 
</configuration> 
+0

對我來說沒有什麼不同,但我以不同的方式工作,請參閱我自己的答案。還有一些我不明白的東西 – gmmo