web-config 相关问题

web.config是一个XML文件,用于存储IIS服务器的主要设置和配置文件。

无法识别的配置部分system.web/configuration

我收到此消息“当我设置管理员、员工和用户身份验证时,无法识别配置部分 system.web/configuration。请帮助我解决此问题。在这里我提供了 web.config 代码 <...

回答 1 投票 0

在 Visual Studio 2022 版本 17.5 中,我面临 ConnectionString 问题

在 Visual Studio 2022 版本 17.5 中,连接字符串会在 Web.config 文件中重复重新生成。每当我删除一个对象(例如存储过程)时,它都会生成一个新的连接字符串

回答 1 投票 0

Ckfinder azure 以编程方式设置后端

我想将 Azure 设置为 CKFinder 的后端,并且我想从 AppSettings 读取值(帐户、密码),而不是后端的 CKFinder 设置。 像这样的东西: 我想将 Azure 设置为 CKFinder 的后端,并且我想从 AppSettings 读取值(帐户、密码),而不是后端的 CKFinder 设置。 像这样的东西: <add key="CKFinderBackendAccountName" value="**********" /> <add key="CKFinderBackendAccountKey" value="************" /> 到目前为止,我有此代码,我只想从 APPSettings 读取 Azure 帐户和密码。我在 ConnectorBuilder 中没有看到相应的属性。 connectorBuilder.LoadConfig() .SetLicense(licenceDomain, licenceKey) .SetAuthenticator(customAuthenticator) .SetRequestConfiguration( (request, config) => { config.LoadConfig(); var defaultBackend = config.GetBackend("azureBackend");} 是的,可以使用 config.AddBackend() 和 config.AddResourceType() var connector = connectorBuilder .LoadConfig() .SetRequestConfiguration( (request, config) => { config.LoadConfig(); string accountName = ConfigurationManager.AppSettings["CKFinderBackendAccountName"]; string accountKey = ConfigurationManager.AppSettings["CKFinderBackendAccountKey"]; // For saving images and files var azStorage = new AzureStorage(accountName, accountKey, "containername", "rootname"); config.AddBackend("azstore", azStorage, baseUrl: "https://isprodgeneral01.blob.core.windows.net/ckfinderstuff", isProxy: false); config.AddResourceType("Images", resourceBuilder => resourceBuilder.SetBackend("azstore", "images").SetAllowedExtensions("bmp", "gif", "jpeg", "jpg", "png")); config.AddResourceType("Files", resourceBuilder => resourceBuilder.SetBackend("azstore", "files").SetAllowedExtensions("7z", "aiff", "asf", "avi", "bmp", "csv", "doc", "docx", "fla", "flv", "gif", "gz", "gzip", "jpeg", "jpg", "mid", "mov", "mp3", "mp4", "mpc", "mpeg", "mpg", "ods", "odt", "pdf", "png", "ppt", "pptx", "pxd", "qt", "ram", "rar", "rm", "rmi", "rmvb", "rtf", "sdc", "sitd", "swf", "sxc", "sxw", "tar", "tgz", "tif", "tiff", "txt", "vsd", "wav", "wma", "wmv", "xls", "xlsx", "zip")); }) .SetAuthenticator(customAuthenticator) .Build(connectorFactory); 您需要确保删除 backend 中 resourceTypes 部分下的 ckfinder 和 web.config 节点 关于此的文档不多,所以我必须自己解决大部分内容,但您可以看看这里的文档是否有帮助 https://ckeditor.com/docs/ckfinder/ckfinder3-net/configuration_by_code.html

回答 1 投票 0

Windows 服务器网站上的简单文件夹密码保护

有没有一种简单的方法可以在 Windows 服务器(例如带有 htaccess 文件的 Linux)上保护目录或整个网站,而无需 root 权限(仅具有 FTP 访问权限)? 只有一个用户需要能够...

回答 1 投票 0

Spring Security 版本 6 .permitAll() 方法

@配置 @EnableWebSecurity 公共类安全配置{ @豆 公共SecurityFilterChain securityFilterchain(HttpSecurity httpSecurity)抛出异常{ httpSe...

回答 1 投票 0

有条件地在 web.config 中添加标头

有什么方法可以使 web.config 中的自定义标头规则例外吗? 我在 web.config 中有标题 X-Frame-Options,它为所有文件添加了它。 有什么方法可以使 web.config 中的自定义标头规则例外吗? 我在 web.config 中有标题 X-Frame-Options,它为所有文件添加了它。 <httpProtocol> <customHeaders> <add name="X-Frame-Options" value="SAMEORIGIN" /> </customHeaders> </httpProtocol> 我想从控制器中的此规则中排除一些页面。 我无法删除控制器中的标头,因为 web.config 在控制器执行后添加了它。 我也不想从 web.config 中删除标头,然后将其添加到控制器或所有页面的控制器属性中,因为这只会为控制器返回的 HTML 文件添加它,而不是静态的HTML 文件、js 文件、图片等等。 我不知道如何在 web.config 中添加标头有条件,如果有可能我可以在控制器中添加一个临时标头,然后编写类似的内容 <httpProtocol> <customHeaders> if(!header("allowembedding")){ <add name="X-Frame-Options" value="SAMEORIGIN" /> } <remove name="allowembedding" /> </customHeaders> </httpProtocol> 我相信你可以使用 <location> 元素来完成这项工作: <configuration> <!-- ... --> <location path="/Path/To/Exclude"> <system.webServer> <httpProtocol> <customHeaders> <remove name="X-Frame-Options" /> </customHeaders> </httpProtocol> </system.webServer> </location> </configuration>

回答 1 投票 0

从 Web.Config 读取变量

如何添加和读取 web.config 文件中的值?

回答 6 投票 0

.conf 文件未检测到 Ubuntu Apache 服务器的 SSL 证书

说我在 /etc/apache2/sites-enabled/placeholder.com.conf 第 5 行遇到语法错误 “SSLCertificatefile:文件‘/Desktop/certificate.crt’不存在或为空。” 我的 .conf 的内容

回答 1 投票 0

自定义错误在 IIS 10 上的 ASP.NET 中不起作用

我使用 IIS 10。在 web.config 中,我有以下默认错误设置: 我使用 IIS 10。在 web.config 中,我有以下默认错误设置: <system.web> <compilation debug="true" targetFramework="4.5.2" /> <httpRuntime enableVersionHeader="false" targetFramework="4.5.2" /> <customErrors mode="On" defaultRedirect="~/Errors/OtherErrors.aspx"> <error statusCode="404" redirect="/Errors/Error.aspx?type=404&amp;Language=FA" /> </customErrors> <sessionState cookieName="TolueSession1" /> </system.web> 我为自定义错误添加了此配置: <system.webServer> <httpErrors errorMode="Custom"> <remove statusCode="400" subStatusCode="-1" /> <error statusCode="400" prefixLanguageFilePath="" path="/Errors/Error.aspx?type=400&amp;Language=FA" responseMode="ExecuteURL" /> .... </httpErrors> <staticContent> <mimeMap fileExtension=".webp" mimeType="image/webp" /> </staticContent> </system.webServer> 但我收到此错误: /Errors/Error.aspx?type=404&语言=FA 并且自定义错误设置不起作用。 我想为每个错误运行自定义错误。 有什么想法吗?

回答 0 投票 0

<system.codedom>/<compilers> 在 MVC 5 的 web.config 中到底做了什么?

我准备将一堆项目从 .NET 4.0 + MVC 3 迁移到 .NET 4.5.2 + MVC5。 为了使这更容易,我创建了一个新的空白 MVC 项目来比较 DLL 引用和其他一些东西,例如 ...

回答 2 投票 0

web.config 转换时出现“源文档中没有元素匹配'/configuration/system.webServer'”

我正在做 web.config 转换。这是我的 web.config - 我正在做 web.config 转换。这是我的 web.config - <?xml version="1.0" encoding="utf-8"?> <configuration> <location path="." inheritInChildApplications="false"> <system.webServer> <httpProtocol> <customHeaders> <add name="X-Content-Type-Options" value="nosniff" /> <add name="Content-Security-Policy-Report-Only" value="frame-ancestors 'self'" /> </customHeaders> </httpProtocol> <handlers> <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" /> </handlers> <rewrite> <rules> <rule name="https redirect"> <match url="(.*)" ignoreCase="false" /> <conditions> <add input="{HTTPS}" pattern="off" ignoreCase="false" /> </conditions> <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}{REQUEST_URI}" /> </rule> </rules> <outboundRules> <rule name="Remove RESPONSE_Server" > <match serverVariable="RESPONSE_Server" pattern=".+" /> <action type="Rewrite" value="" /> </rule> <rule name="Adding HSTS" enabled="true"> <match serverVariable="RESPONSE_Strict_Transport_Security" pattern=".*" /> <conditions> <add input="{HTTPS}" pattern="on" ignoreCase="true" /> </conditions> <action type="Rewrite" value="max-age=31536000" /> </rule> </outboundRules> </rewrite> <aspNetCore processPath="dotnet" arguments=".\App.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess"> <environmentVariables> <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Local" /> </environmentVariables> </aspNetCore> </system.webServer> <system.web> <httpCookies httpOnlyCookies="true" requireSSL="true" /> </system.web> </location> </configuration> 我的 web.release.config 和 web.config 一样。 web.Development.config 如下所示。 <?xml version="1.0" encoding="utf-8"?> <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> <system.webServer> <aspNetCore processPath="dotnet" arguments=".\App.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout"> <environmentVariables> <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" xdt:Transform="Replace" xdt:Locator="Match(name)"/> </environmentVariables> </aspNetCore> </system.webServer> </configuration> 但是当我使用“dotnet publish --configuration Development /p:EnvironmentName=Development”命令发布时,它说 No element in the source document matches '/configuration/system.webServer' 此外,在部署到服务器时,我得到了这个 - [apply APPName_DEV\web.Development.config to APPName_DEV\web.config] W:\Buildnumber\APPName_DEV\web.Development.config:7,7 - No element in the source document matches '/configuration/system.webServer' 请帮助我,提前致谢:) 我认为您需要从基本配置中删除<location>或将<location>添加到您的开发配置中。 你正在尝试更换<configuration><system.webServer> 但是在你的基本配置中你有<configuration><location><system.webServer>

回答 1 投票 0

无法获取 IFRAME 加载页面以在 ASP.NET 应用程序中使用 cookie

我有一个映射到特定域的 URL 的 ASP.NET 应用程序,该应用程序包含加载 IFRAME 的页面,其 src 指向另一个域的 URL(也是 ASP.NET 应用程序)。 我可以得到...

回答 0 投票 0

web.config 中的重写规则未触发,但匹配正则表达式101

我无法触发我的 URL 重写规则。 我正在测试的 URL:https://www.example.com/emailclick/d16f5a8d-e15c-40a1-9935-addf37dc139b/https%3a%2f%2fwww.example.com%2ftest%2fnyc%2f17690167%

回答 0 投票 0

IIS 7.5:以编程方式将“应用程序池用户”设置为匿名用户

我在 IIS 7.5 中有一个 Web 应用程序,它有自己的使用 .net 4 的 AppPool。 我想使用具有匿名访问权限的功能作为应用程序池身份——这很容易通过 inetmgr 在 GUI 中配置 ...

回答 4 投票 0

如何在 Azure 的 Web 配置中将所有路由重定向到索引页面?

我正在使用部署在 Azure 上的 React 应用程序。我正在使用反应路由器 Browserhistory 模块。目前我在 Azure 的 web.config 中有以下规则: 我正在使用部署在 azure 上的 React 应用程序。我正在使用反应路由器 Browserhistory 模块。目前我在 Azure 的 web.config 中有以下规则: <rule name="admin rule" stopProcessing="true"> <match url="admin" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> <add input="{REQUEST_URI}" matchType="Pattern" pattern="api/(.*)" negate="true" /> </conditions> <action type="Rewrite" url="/" /> </rule> 这有效,/admin 路由可以刷新并在浏览器 URL 窗口中手动输入。如果不应用此规则,我将无法刷新或手动输入 URL。 (参见问题:React-router URLs 在刷新或手动写入时不起作用) 但我实际上希望它适用于每条路线,也适用于动态路线。例如: /购物车 /产品/唯一标识 /例子 我可以编写哪个规则,以便像在管理路由中一样将每条路由重写到索引? 您应该能够将您的管理员匹配规则替换为 <match url=".*" /> 就在您的开始 <conditions> 标签上方。查看这篇博文了解更多信息。

回答 1 投票 0

MVC项目的views文件夹中的Web.Config文件是做什么的

我在部署我的应用程序时遇到了一些问题,在进行故障排除时,我发现了 Views 文件夹中的 Web.Config 文件。试图缩小来源的可能性......

回答 4 投票 0

httpRuntime 与 web.config 中的编译 - ASP.NET 网站的 targetFramework

我使用 visual studio 2019 将 ASP.NET 网站应用程序从 .NET Framework 4.0 升级到 4.8 我使用 web.config 中的此配置将应用程序部署到 IIS: 我已经使用 visual studio 2019 将 ASP.NET 网站应用程序从 .NET Framework 4.0 升级到 4.8 我在 web.config 中使用此配置将应用程序部署到 IIS: <compilation debug="true" targetFramework="4.8" /> 此设置是否足以让我的网站为客户正常工作? 我在某处读到我还需要设置 httpRuntime 标签而不仅仅是编译标签如下: <httpRuntime targetFramework="4.8" /> 我的问题: 1- 如果我跳过此 httpRuntime 设置,那么应用程序将在客户端和服务器端 (IIS) 的什么框架下运行?我想服务器会使用4.8的编译标签设置来编译运行网站,但是客户端呢(问题2)? 2- 如果我跳过此 httpRuntime 设置并且客户端的 .NET RunTime 框架低于 4.8(可能是 4.5),那么这会在浏览器中产生错误吗? 3-如果问题2的答案是肯定的,那么如何解决?在这种情况下,我应该添加较低框架的 httpRuntime 设置吗?像这样: <httpRuntime targetFramework="4.5" /> 当然还有编译标签? 4- 我可以完全省略编译标签吗?只保留 httpRuntime?或者这会导致我的网站应用程序无法在服务器中编译? 请帮助这两个令人困惑的配置的最佳实践 谢谢

回答 0 投票 0

Umbraco 8 web.config 更新 SMTP 设置

我正在使用 Umbraco 8,并且 SMTP 设置发生了某种变化。我需要更新它们。我的 github 存储库中没有 web.config。客户支持告诉我没有 FTP 访问权限。我

回答 2 投票 0

使用 web.config 重定向 Azure Web App 中的特定文件

我有一个运行 ASP.NET MVC(非核心)的 Azure Web 应用程序。它前面没有应用程序网关。我需要重定向特定文件。为了这个问题,我们称文件为 abc.txt ...

回答 0 投票 0

Azure 使用带有令牌的长 URL 给出错误

我已经使用 React 和 React Router Dom 将前端应用程序托管到 Azure。 我有一个带有令牌的重置密码链接,如下所示 https://abc.azurewebsites.net/reset/CfDJ8AkOTLe70aJDl6Jq93G40f4OoMX35xv1bg73%

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.