我有这个配置工作,并正确重定向以下错误
<httpErrors errorMode="Custom"
existingResponse="Replace"
defaultResponseMode="ExecuteURL" >
<remove statusCode="403" />
<remove statusCode="404" />
<remove statusCode="500" />
<error statusCode="403" responseMode="ExecuteURL" path="/Error/AccessDenied" />
<error statusCode="404" responseMode="ExecuteURL" path="/Error/PageNotFound" />
<error statusCode="500" responseMode="ExecuteURL" path="/Error/ApplicationError" />
</httpErrors>
Run Code Online (Sandbox Code Playgroud)
但是当我添加以下默认路径以尝试添加catch all时
<httpErrors errorMode="Custom"
existingResponse="Replace"
defaultResponseMode="ExecuteURL"
defaultPath="/Error/ApplicationError">
Run Code Online (Sandbox Code Playgroud)
服务器抛出web.config错误
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Module CustomErrorModule
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激!!
我的标题中有一个非常简单的局部视图叫做AccountInfoPanel.它只有一行:
Welcome: @HttpContext.Current.User.Identity.Name
Run Code Online (Sandbox Code Playgroud)
在我的Web.Config我有
<authentication mode="Windows" />
Run Code Online (Sandbox Code Playgroud)
但身份名称始终为空.如果我通过VS 2012调试,并打破索引操作,我看到它是空的.
如果我通过启用Windows身份验证和匿名身份验证的IIS运行它,我会遇到挑战.所以我尝试插入我的帐户或test1和test2帐户.它回来说:
HTTP错误401.1 - 未经授权您无权使用您提供的凭据查看此目录或页面.
我也尝试将Impersonation设置为true并从挑战中获得相同的响应.有谁知道如何设置它?
如果所有设置都必须在IIS中完成,那么如何在Visual Studio中调试代码?
另一个问题.我的老板似乎认为你甚至不需要登录框.IE会知道你是谁.并且您可以使用其他帐户在IE中"运行".
我目前正在使用 Visual Studio Professional 2019,并且有以下用例。
我正在尝试使用 X509 进行用户身份验证。我提示输入证书并通过 IOwinRequest.Environment 查找它并查找属性 ssl.ClientCertificate
在我的初创公司中我正在使用这样的东西
app.UseClientCertificateAuthentication(new DefaultClientCertificateValidator());
Run Code Online (Sandbox Code Playgroud)
这反过来最终会达到
ClientCertificateValidationResult validationResult = await Task<ClientCertificateValidationResult>.Run(() => ValidateCertificate(Request.Environment));
if (validationResult.CertificateValid)
{
// Do some stuff
}
Run Code Online (Sandbox Code Playgroud)
private ClientCertificateValidationResult ValidateCertificate(IDictionary<string, object> owinEnvironment)
{
if (owinEnvironment.ContainsKey(_owinClientCertKey))
{
X509Certificate2 clientCert = Context.Get<X509Certificate2>(_owinClientCertKey);
return _clientCertificateValidator.Validate(clientCert);
}
Run Code Online (Sandbox Code Playgroud)
如果我将其投入生产并使用一些日志语句,我可以看到事情按正确的顺序发生并实际验证(这很好)。但是,我想在调试中实际运行此操作,以便我可以测试其他一些项目。
在 Visual Studio 中运行时,它通过 IIS Express 运行。在我的项目属性中,我启用了 SSL,并且可以在 https://localhost:44300/ 上访问该 url,但是,它从不提示输入用户证书。
如果这个应用程序在产品中,我只需进入 IIS,进入 SSL 连接部分并要求用户传递证书。有没有办法在 Visual Studio 的 IIS Express 中执行此操作?
我想 Web.Config 或 AppHost 文件中可能会有一些东西
C:\directory.vs\solution_name\config\applicationhost.config
但我可能错过了一些愚蠢的事情。
任何帮助都会很棒!
我在 Windows 10 下运行 IIS Express(不要与普通 IIS 混淆)。我的理解是设置存储在“My Documents\IISExpress\config\applicationhost.config”中
使用创建 ASP.NET Core 项目时,可以通过本地 web.config 文件覆盖这些设置。
当尝试使用此 web.config 时
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="" inheritInChildApplications="false">
<system.webServer>
<security>
<authentication>
<anonymousAuthentication enabled="false" />
<windowsAuthentication enabled="true" />
</authentication>
</security>
</system.webServer>
</location>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我收到以下错误。
该配置节不能在此路径中使用。当该部分被锁定在父级别时,就会发生这种情况。锁定可以是默认设置 (overrideModeDefault="Deny"),也可以通过位置标记使用 overrideMode="Deny" 或旧的allowOverride="false" 显式设置。
识别这条线
<authentication>
**<anonymousAuthentication enabled="false" />**
<windowsAuthentication enabled="true" />
Run Code Online (Sandbox Code Playgroud)
尽管将此行更改为状态允许
<section name="anonymousAuthentication" overrideModeDefault="Allow" />
Run Code Online (Sandbox Code Playgroud)
还有其他我应该寻找的地方吗?
我正在尝试连接 Flutter 的 HttpClient 以从我在 ASP.Net Core 3.0 上运行的本地服务器获取数据。问题是我每次尝试时都会收到错误 400(错误请求)。
这是颤振代码:
String token = await SharedPreferencesService.getStringFromSF('idToken');
var client = new HttpClient();
client.badCertificateCallback =
(X509Certificate cert, String host, int port) => true;
HttpClientRequest request =
await client.getUrl(Uri.parse('https://10.0.2.2:44383/weatherforcast'));
request.headers.add('idToken', token);
HttpClientResponse response = await request.close();
String reply = await response.transform(utf8.decoder).join();
Run Code Online (Sandbox Code Playgroud)
asp.net core 3.0 端点:
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
[HttpGet]
public User Get()
{
return new User { UserId = 1332, Username = "Michal" };
}
}
Run Code Online (Sandbox Code Playgroud)
错误
<HTML><HEAD><TITLE>Bad …Run Code Online (Sandbox Code Playgroud) 我正在尝试在 VS2015 中加载一个 Web 项目,但出现以下错误。
创建虚拟目录 http://localhost:16858/ 失败并显示错误:文件名:redirection.config 错误:无法读取配置文件。
我试图删除 *.csproj.user 来重建文件。但它没有用。
如何解决这个问题呢 ?有什么建议 ?
asp.net ×3
iis-express ×3
asp.net-core ×2
.net ×1
android ×1
blazor ×1
c# ×1
flutter ×1
gltf ×1
iis-7 ×1
owin ×1
static-files ×1
three.js ×1
web-config ×1
windows ×1