已发布的asp.net不断要求登录凭据
问题描述:
我想发布一个测试网站到托管服务,我相信这是运行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=\"Web\" /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!");
}
}
}
谢谢!
答
只有我它得到的工作是这个部分从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控制面板生成?我仍然没有看到方法。
谢谢。
答
通过更改Web配置将认证类型更改为Anonymous Authentication
。
<configuration>
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</configuration>
对我来说没有什么不同,但我以不同的方式工作,请参阅我自己的答案。还有一些我不明白的东西 – gmmo