基本上我想使用反向代理重写 url: from:
http://www.xyz.in/eacc/api/fetchVendors
到
http://localhost:8080/eacc/api/fetchVendors
我已经在 C:\Tomcat\apache-tomcat-9.0.7\webapps\eacc 下的 tomcat 中部署了我的 Spring Boot Rest 完整 Web 服务应用程序。
它包含许多 POST 调用,如 /eacc/api/fetchVendors、/eacc/api/users、/eacc/api/clients.. 等。
现在我想通过 IIS 公开这个 eacc rest 应用程序。
配置了名为 www.xyz.in 的主网站。
在名为 /eacc 的网站 (www.xyz.in) 下添加了虚拟目录。物理路径:C:\inetpub\wwwroot\eacc 下面是 web.config 文件。
当我尝试打一个像www.xyz.in/eacc/api/fetchVendors这样的帖子调用时,得到 HTTP 404 服务器错误。
描述:HTTP 404。您要查找的资源(或其依赖项之一)可能已被删除、更改名称或暂时不可用。请检查以下 URL 并确保其拼写正确。
请求的网址:/eacc/api/fetchVendors
我的/eacc 的web.config 文件- 虚拟目录
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpRedirect enabled="false" />
<rewrite>
<rules>
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="http://localhost:8080/eacc/{R:1}" />
</rule> …Run Code Online (Sandbox Code Playgroud) 这是我第一次在 ASP.NET 中发布 Web 表单项目。我遇到过可能的 http 错误,但我不明白这个错误。我的IIS版本是10.0
HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler.
Run Code Online (Sandbox Code Playgroud)
我在互联网上看到了很多解决方案,有一个共同点,并且正在运行
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -i in cmd.
Run Code Online (Sandbox Code Playgroud)
但我确实收到此错误:
Microsoft (R) ASP.NET RegIIS version 4.0.30319.0
Administration utility to install and uninstall ASP.NET on the local machine.
Copyright (C) Microsoft Corporation. All rights reserved.
Start installing ASP.NET (4.0.30319.0).
This option is not supported on this version of the operating system. Administrators should instead install/uninstall …Run Code Online (Sandbox Code Playgroud) 我知道这已被问了一千次......但是我仍然遇到问题,尽管有两天的尝试!
这是在本地运行.甚至我的localhost给了我一个403!
我的设置:
IIS中的每个站点都会使用旧的"HTTP Error 403.503 - Forbidden"错误来问候我.我摆弄了应用程序池设置,重新启动,重新注册(aspnet_regiis -i),使用"以管理员身份运行",将IUSER添加到安全性并完全控制,在Visual Studio 2015中创建了一个新的MVC应用程序并将该站点添加到IIS ......我已经尝试了所有我能想到的东西!
在删除Windows之前,有没有人对我有任何建议?
空的web.api项目,安装Microsoft.aspnet.webapi.cors 5.2.3,添加
config.EnableCors();
Run Code Online (Sandbox Code Playgroud)
到webapiconfig。使控制器和动作
public class HomeController : ApiController
{
[EnableCors("*" , "*" , "*")]
public async Task<string> Get()
{
return await Task.FromResult("omg");
}
}
Run Code Online (Sandbox Code Playgroud)
调试应用程序并加载提琴手,并向http:// localhost:61939 / api / Home发出请求
没有CORS标头。web.config包含:
<system.webServer>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
Run Code Online (Sandbox Code Playgroud)
我想念什么?为什么这不会在对Get方法的所有请求中插入Access-Control-Allow-Origin标头?
同样,在web.config中定义CORS的答案也不是答案。在某些时候,我将需要添加原始检查,甚至可能需要检查HTTP方法,例如:
if(requestContext.HttpMethod == "POST" && (origin == "https://someplace.com" || origin == "http://localhost"))
Run Code Online (Sandbox Code Playgroud) DELETE 方法在 IIS 10 中显示以下错误
请求的资源上不存在“Access-Control-Allow-Origin”标头。
所有其他方法(如 POST 和 GET)都可以正常工作。此外,DELETE 在开发时在 iis express 中运行良好。我为 WebApiConfig 类中的所有请求启用了 cors
public static void Register(HttpConfiguration config)
{
config.SuppressDefaultHostAuthentication();
config.Filters.Add(new HostAuthenticationFilter(OAuthDefaults.AuthenticationType));
// Web API routes
config.MapHttpAttributeRoutes();
var cors = new EnableCorsAttribute("*", "*", "*");
config.EnableCors(cors);
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional }
);
Run Code Online (Sandbox Code Playgroud)
我的网络配置看起来像这样
<?xml version="1.0" encoding="utf-8"?> <!-- For more information on how to configure your ASP.NET application, please visit http://go.microsoft.com/fwlink/?LinkId=301879 --> <configuration> <configSections>
<!-- For more information on Entity Framework …Run Code Online (Sandbox Code Playgroud) 我有带有 4 个 IIS 10 Web 服务器的 GCP 负载平衡器。偶尔会出现502-Server error。在日志中它显示这是因为backend_connection_closed_before_data_sent_to_client。我已经通读了这篇文章https://cloud.google.com/compute/docs/load-balancing/http/,它说 nginx 和 apache 的 keepalive timout 需要设置为 620 秒。我如何在 IIS 10 中做同样的事情。
我试图同时打开大约 25 个与主机的连接。
我的操作系统是 windows 10。
为了进行测试,我在本地打开了一个简单的网站,IIS并使用Thread.Sleep(2000).
现在在客户端上使用此代码:
const int len = 25;
for (int i = 0; i < len; i++)
{
new Thread(new ParameterizedThreadStart((idx) =>
{
// start downloading data.
var res = new WebClient().DownloadString("http://192.168.1.101:8090/");
// log index and time when done.
Console.WriteLine($"{Convert.ToInt32(idx).ToString("00")} done at:{ DateTime.Now.ToString("HH:mm:ss:ffff") }");
})).Start(i);
}
Run Code Online (Sandbox Code Playgroud)
我得到了以下结果:
Thread 01 done at 40:8476 ms
Thread 00 done at 40:8476 ms
Thread 03 done at 40:8496 ms
Thread 04 done at 40:8496 ms …Run Code Online (Sandbox Code Playgroud) 我正在使用 URL 重写来强制 http 到 https 重定向。它正在工作,只是它在 URL 中添加了第二个尾部斜杠。例如,如果我访问http://example.com,重写的 URL 最终会是https://example.com//。我什至不想要 1 个尾部斜杠,更不用说 2 个,而且我无法摆脱它。我尝试了这个解决方案,但没有成功。可能是因为这个人想去掉结尾的斜杠,而我有两个斜杠,所以它不匹配?
我的 web.config 文件中有以下规则。我正在运行带有 IIS 10 和 URL 重写模块的 Windows Server 2019。如果有人能告诉我哪里出错了,我将不胜感激!
<rule name="HTTPS Redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{REQUEST_URI}" appendQueryString="false" />
</rule>
<rule name="SEO - Remove trailing slash" stopProcessing="false">
<match url="(.+)/$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTP_METHOD}" pattern="GET" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action …Run Code Online (Sandbox Code Playgroud) 在 IIS 管理器中,我只看到添加连接,其他选项(例如默认网站、添加新网站)不可用。尽管一切都按顺序安装(通过“打开或关闭 Windows 功能”进行检查)。
其Windows 10和IIS版本如下
任何线索,如何在 IIS 中获取默认网站或在此处添加新网站?
观看了关于同一问题的几个主题。没有一个对我有用。问题是:我有从 create-react-app 设计的 ReactJS + Redux 应用程序。实际上它可以工作,但是当应用程序冲浪以不同于 root 的 URL 开始时,会抛出 404。安装iisnode并尝试了网络中推荐的不同重写规则,但没有任何效果。最后是这个:
<rule name="Redirect HTTP to HTTPS">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent"/>
</rule> -->
<rule name="Redirect non-existent paths to root">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/initialLogin/*" ignoreCase="true" negate="true" />
</conditions>
<action type="Redirect" url="/" appendQueryString="false" />
</rule>
</rules>
</rewrite>
Run Code Online (Sandbox Code Playgroud)
我唯一需要的是通过根 url 发送所有传入请求,并将其余地址传递给它,以便 SPA 可以正常工作。托管:AzureVM IIS:v10
编辑:另一个奇怪的事情是它iisnode可以处理 …
我正在尝试使用IIS托管asp.net核心2.1网站.但是,当我安装.net core 2.1主机包和链接重写包时,我不断收到此错误:
HTTP错误500.19 - 内部服务器错误无法访问请求的页面,因为页面的相关配置数据无效.
详细错误信息:
模块IIS Web核心
通知未知
处理程序尚未确定
错误代码0x80070005配置错误由于权限不足,无法读取配置文件
配置文件\\C:\用户\ USER \源\回购\ Frontis.Forecast\Frontis.Forecast\Frontis.Forecast.Web\BIN \发布\ PublishOutput \的web.config
iis-10 ×11
iis ×7
asp.net ×2
c# ×2
cors ×2
.net-core ×1
asp.net-core ×1
http ×1
http-delete ×1
http-error ×1
iis-express ×1
node.js ×1
reactjs ×1
rest ×1
tomcat9 ×1
web-hosting ×1
windows ×1
windows-10 ×1