问题标签 [web-administration]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
104 浏览

mod-rewrite - 使用 mod_rewrite 重定向 ErrorDocument 自定义页面 (500,503)?

我想在 IBM HTTP Server 上的 500 和 503 错误文档上使用自定义页面,以及缩短 URL 也使用重写该代码以缩短 URL (WCS)。

以下是我正在使用的规则:

当我不使用缩短 URL 代码时,ErrorDocument 500 /500.html 自定义页面工作正常。但是当我使用缩短 URL 代码时,ErrorDocument 500 /500.html 自定义页面不起作用。当我使用像 ErrorDocument 500 "Server in a problem so We will be back" 这样的字符串时,在两种情况下都可以使用缩短的 URL 代码或不使用缩短的 URL 代码。

0 投票
2 回答
160 浏览

powershell - Powershell: Dynamically gather data types for IIS configuration element validation

I'm attempting to dynamically use the Microsoft.Web.Administration namespace within a powershell cmdlet.

Is there a way to add a variable into a Namespace.Class declaration.

I'm using the namespace [Microsoft.Web.Administration] and it's class [Microsoft.Web.Administration.ApplicationPool], it has a property under it 'Recycling' that you can access using a GetProperty method.

If you spit out the PropertyType of the above using this

You get this result,

Microsoft.Web.Administration.ApplicationPoolRecycling

which is another class. I now want to access this class dynamically within the cmdlet. How do access this class from within the code, I want the code to dynamically discover the new class of the object and then access that class. But I can't find a way to accomplish this.

Psuedocode for what I'm trying

So I'm not sure if there's a way to have a TypeName for an object put in as a string value and I can't seem to find a way to cast the variable as anything else. Sorry if this is remedial, I'm a basement grown coder and just learn things as I go.

EDIT: As requested by Mathias below in the comments, an overview of what I'm trying to achieve.

I have a script that automates the configuration of many IIS components. At this time I'm attempting to add validation to the cmdlet Set-AppPoolConfiguration that I've created that allows a configuration to be fed into the cmdlet that configures an AppPool (this is used to deploy websites/weapplications throughout a distributed web environment). Utilizing the details inside the Microsoft.Web.Administration I'm able to get enum values, as well as types of the many configuration components of an AppPool. This is saving me time to where I don't have to hard code in the data types and can just dynamically discover them and do validation on the values when the specific configuration element is chosen.

For example. If an AppPool Recycle schedule is need to be configured, I need to validate it against a TimeSpan data type. If it is not a TimeSpan data type issues will arise when being added to the ScheduleCollection. So I'm looking to validate the value provided before attempting to add it.

Since there are many AppPool configuration elements, I don't want to have to create a massive switch or if/elseif chain that checks each configuration element and statically dictate what data type it is for validation. I want the class itself to dynamically provide this information to simplify the code.

I can get the majority of these data types by simply accessing the property chain within the namespace. For example, if you want to know what type is required for the QueueLength, use this:

And you'll get Int64.

It's also extremely useful for getting enums.

However attempting this with Schedule and you run into a small issue as it returns ScheduleCollection. This is true of any of the configuration elements that are part of a collection.

However the knowledge that the schedule item inside the ScheduleCollection is only accessible from within the Schedule class. My code currently checks to see if it is a collection, and then if it is, it is attempting to access that collection/class and get the information that is required. To find out that schedule is a TimeSpan you have to access it's specific class instance:

Now AppPools are simple, there's only a single collection group that is normally edited, so hard coding in that if you're attempting to set a new recycle schedule it will be a TimeSpan isn't that big of a deal, however when we move over to WebSite/WebApplication configurations, it becomes more tedious to statically declare data types for each configuration element that is part of a collection, and becomes more useful to try and discover these dynamically based on the configuration element selected.

This was my initial approach, I just included the above for clarity. I'm going to step back and take another look at how to attack this as this does not appear to be as easy as I had hoped, I'll post my solution here.

0 投票
2 回答
1395 浏览

powershell - 列出重定向目标 (URL) IIS 站点

我在 IIS 8.5 中配置了几个重定向站点,我想将它们全部列出。我试过了:

但通配符不适用于appcmd. 我也从WebAdministration模块中尝试过:

但这也没有提供我需要的东西......这是一个包含 2 列站点和目的地的列表

0 投票
1 回答
60 浏览

c# - 我怎样才能在 C# 中做到这一点?

我怎么能在c#中做到这一点

如何在 IIS 中为应用程序设置输出缓存?以编程方式

0 投票
1 回答
513 浏览

.net - 使用 Microsoft.Web.Administration 将 AspNetCore 参数添加到 IIS 应用程序

我需要在服务器上托管 ASP.NET Core 应用程序的多个实例,每个实例都通过命令行参数进行不同的配置。Web 应用程序实例使用带有 Microsoft.Web.Administration API 的 Windows 窗体应用程序进行管理。

在不使用 WinForms 应用程序的情况下,我可以通过使用配置编辑器为 IIS 管理器中的每个站点添加参数并将“From”设置为 ApplicationHost.config 来使用多个实例。这为每个要使用的应用程序实例设置了不同的参数,同时仍然从同一个 ASP.NET Core .exe 运行。

我无法将其转换为 WinForms 应用程序中的功能。通过该工具添加实例时<location>,ApplicationHost.config 中添加了一个新元素,我需要为其添加一个 <aspNetCore arguments="xxxx" />子元素。

0 投票
0 回答
632 浏览

umbraco7 - Umbraco:计划任务/发布/保持活动不工作

我在 Umbraco 7.7.6 上遇到问题,基本上服务器会调用自己的任务/发布/保持活动细节:

http://issues.umbraco.org/issue/U4-5391

问题是服务器管理员不允许从网络服务器外部访问互联网,这意味着http://(domain)/umbraco无法访问,并且 Umbraco 在日志文件中抛出以下错误。

如何在不从服务器提供到 Internet 的出站连接的情况下缓解该问题?

0 投票
1 回答
2812 浏览

powershell - 使用 powershell 下载通过 https 调用生成的文件

目前我有这段简短的代码。该 URLhttps://dosomething.do会生成一个 .csv 文件。我可以运行 powershell 代码,在 shell 中我可以看到文件的内容。但是文件本身没有下载。我想指定下载后的保存位置。我在这里有什么选择?

0 投票
2 回答
1512 浏览

c# - 如何在不受信任的域中模拟用户?

机器 A机器 B位于不同的域中。机器 A使用 VPN 访问机器 B 的网络。

我试图冒充用户,以便在Machine BMicrosoft.Web.Adminstration上的 IIS 中执行一些管理操作。

我试过的

  • 我在这里尝试了解决方案:https://forums.iis.net/t/1162205.aspx?Using+Microsoft+Web+Administration+on+a+remote+machine+not+in+the+domain。LogonUser 的 returnValue 对我来说是错误的。当我开始写这篇文章时,我想可能不同之处在于发布者正在使用两个不同但受信任的域中的机器,尽管现在我看到他的一台机器只是在一个工作组中。老实说,我不确定这种情况与我的情况相比如何……它是否应该有效地相同。

  • 我还尝试了另一种解决方案,该解决方案使用不同的登录类型值(NewCredential 而不是 Interactive)和不同的登录提供程序(WinNt50 而不是 Default),因为它声称它解决了我的域不受信任的问题。

  • 还尝试将这两种解决方案结合起来,但到目前为止没有任何效果

额外信息:

我开始在 asp.net mvc 项目中执行此操作,但是当第一个解决方案需要我调用时切换到控制台应用程序CoInitializeSecurity,显然,它要求它没有被事先调用并且我不知道如何防止它一个 mvc 项目(在控制台应用程序中,我只需要禁用 Visual Studio 托管进程)。

我应该提一下,我可以使用NetworkCredential该类和NetworkConnection类(https://gist.github.com/AlanBarber/92db36339a129b94b7dd)连接到目标机器并写入文件。所以我绝对知道用户/密码可以工作,我可以从客户端机器上使用它们来访问文件。我只是不知道如何模仿他们。

我不认为我可以立即为此提供赏金,但如果有人能够提供解决方案,我会尽快添加赏金并将其提供给您。

0 投票
1 回答
757 浏览

nginx - Nginx 反向代理无法按预期工作

我在不同的 nginx(1.15.0) 服务器上有两个域(server1 example.comserver2 example.net)。我尝试使用ngx_http_substitutions_filter_module将server2设置为反向代理,但它没有按预期工作。由于我的配置,subs_filter指令应该将example.com替换为example.net但是当我在浏览器中键入example.net时,它会将我重定向到example.com

nginx.conf

例子.net.conf

替换.conf

似乎 nginx 忽略了subs_filter指令。有人可以解释一下如何使用 ngx_http_substitutions_filter_module 正确替换 uri 吗?谢谢你的建议!

0 投票
2 回答
3491 浏览

powershell - 执行invoke-webrequest以获取Powershell中多个网站的状态

我们有几个网站,我不想invoke-webrequest -URI google.com每次都检查 powershell 中的状态。

我起草了这样的东西,但它不起作用,我需要帮助:

我想检查几个网页的状态并将其导出为 CSV 格式website name, statuscode