简体   繁体   English

CORS 关于在 Azure 虚拟机之外的浏览器上访问 Web 应用程序的问题

[英]CORS ISSUES on Accessing Web Application on a Browser Outside Azure Virtual Machine

Good day all, I have an Angular and Asp.net Core Application deployed on IIS in Azure Virtual Machine.大家好,我有一个 Angular 和 Asp.net 核心应用程序部署在 IIS 虚拟机 Z3A580F142203677F1F3BC308 上。 It is working perfectly work on the IIS Localhost on the AZURE Virtual Machine but when trying to access the Application outside Virtual Machine using the IP address and the Port number, am having CORS Issue from origin 'http://10.95.102.55:95' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Credentials' header in the response is '' which must be 'true' when the request's credentials mode is 'include'. It is working perfectly work on the IIS Localhost on the AZURE Virtual Machine but when trying to access the Application outside Virtual Machine using the IP address and the Port number, am having CORS Issue from origin 'http://10.95.102.55:95'已被 CORS 策略阻止:对预检请求的响应未通过访问控制检查:响应中的“Access-Control-Allow-Credentials”header 的值为“”,当请求的凭据模式时必须为“真”是“包括”。 The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute. XMLHttpRequest 发起的请求的凭证模式由 withCredentials 属性控制。

Please what could be the Problem because it is working on the Virtual Machine but outside the Virtual Machine is the problem, Have disable Window Firewall and Set both Inbound and Out-Bound rules on the Port.请问可能是什么问题,因为它在虚拟机上工作但在虚拟机外部是问题,禁用 Window 防火墙并在端口上设置入站和出站规则。 Please help is needed请帮忙

Apply the below changes in your deployed application in iis.在 iis 中部署的应用程序中应用以下更改。

<system.webServer>
<httpProtocol>
    <customHeaders>
        <add name="Access-Control-Allow-Origin" value="*" />
        <add name="Access-Control-Allow-Methods" value="GET,POST,OPTIONS" />
        <add name="Access-Control-Allow-Headers" value="Content-Type, soapaction" />
    </customHeaders>
</httpProtocol>
</system.webServer>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 502 异常 - Azure 虚拟机 - 502 Exception - Azure Virtual Machine .NET Core 2 Web API:CORS 问题 - .NET Core 2 Web API: CORS issues Laravel + Angular 从外部网络访问被 CORS 阻止 - Laravel + Angular accessing from outside network blocked by CORS 从在一台机器上工作的浏览器下载 S3 图像并在另一台机器上出现 CORS 错误 - Downloading S3 image from browser working on one machine and giving CORS error on another machine CORS 从 .net 核心 web Z8A5DA52ED126447D359E70C05721 进行重定向时出现问题 - CORS issues when doing redirection from .net core web api CORS 问题 Angular MSAL Azure AD Do.net Core Web API - CORS Issue with Angular MSAL Azure AD Dotnet Core Web API CORS issue in Angular app deployed to Azure static web app - CORS issue in Angular app deployed to Azure static web app Angular 应用程序显示 cors 问题而不重定向到 azure 广告登录页面 - Angular application show cors issue and not redirecting to azure ad login page 从远程计算机访问JHipster应用程序(在开发模式下运行) - Accessing a JHipster application (running in dev mode) from a remote machine 从容器外部访问 dockerized 节点应用程序时出现问题 - Problem accessing dockerized node application from outside of container
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM