.NET 平台文件扩展名是什么?

发布于 2024-11-26 00:02:08 字数 1343 浏览 0 评论 0 原文

我已经在 Linux 服务器上安装了 mono 平台,并且能够在 nginx HTTP 服务器后面运行它。该系统运行良好,可以完美地服务 .NET 特定的动态文件。

但是,我只想将所需的文件(通过扩展名)传递给 mono,并让 nginx 处理所有其他文件,包括静态文件和 .NET 平台上正常情况下不应提供的文件。我已经配置了我的 nginx,如下所示,但是 - 由于我对 .NET 平台没有足够的了解 - 我不确定哪些扩展 应该 必须传递给 mono,哪些扩展必须被禁止。

这是我的 nginx 配置文件的相关部分:

# Do not pass .NET forbidden extensions to anywhere.
# Theese are the extensions that should not be served to the clients
location ~ \.(config|dbml|dll|master|other|forbidden|exts)$ {
    deny all;
}

这是将所需(仅需要)文件传递给 mono 的配置部分:

# Theese are the extensions which *must* be handled by mono
location ~ \.(aspx|cs|other|exts|that|must|be|handled|by|mono)$ {
    fastcgi_pass    127.0.0.1:9000;
    fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include         fastcgi.conf;
    fastcgi_index   default.aspx;
}

# Other static files will be handled by nginx.

我从 维基百科条目,但它们还远未完成。

所以我的问题包含三个子问题:

  • .NET 平台特定的文件扩展名是什么?
  • 其中哪些必须由.NET 引擎处理?
  • 其中哪些属于机密且不得送达客户?

这将是一个共享托管环境,因此任何缺少的扩展都可能会给用户带来不良影响(例如泄露用户密码或应用程序设置)。

I have installed mono platform on my Linux server and I was able to run it behind nginx HTTP server. The system is working well and serving .NET specific dynamic files flawlessly.

However, I want to pass only (and only) required files (by extension) to mono and let nginx handle all the other files including static files and the files that should not be served in normal circumstances on .NET platform. I have configured my nginx as seen below but - since I don't have enough knowledge about .NET platform - I am not sure which extensions should must be passed to mono and which ones must be forbidden.

Here is the related part of my nginx configuration file:

# Do not pass .NET forbidden extensions to anywhere.
# Theese are the extensions that should not be served to the clients
location ~ \.(config|dbml|dll|master|other|forbidden|exts)$ {
    deny all;
}

And here is the configuration part that will pass required (only required) files to mono:

# Theese are the extensions which *must* be handled by mono
location ~ \.(aspx|cs|other|exts|that|must|be|handled|by|mono)$ {
    fastcgi_pass    127.0.0.1:9000;
    fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include         fastcgi.conf;
    fastcgi_index   default.aspx;
}

# Other static files will be handled by nginx.

I have found some .NET specific file extensions from Wikipedia entry but they are far from complete.

So my question has three sub-questions:

  • What are the .NET platform-specific file extensions?
  • Which of them must be handled by .NET engine?
  • Which of them confidential and must not be served to the clients?

This will be a shared hosting environment so any missing extension may result undesirable effects to user (eg. Revealed user passwords or application settings).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

画离情绘悲伤 2024-12-03 00:02:08

最容易查看的地方可能是主 web.config 文件,它是声明 ASP.NET 基本设置的地方。这包括 ,例如:

<httpHandlers>
  <add verb="*" path="*.rules" type="System.Web.HttpForbiddenHandler" validate="true"/>
  <add verb="*" path="*.xoml" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false"/>
  <add path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false"/>
  <add path="trace.axd" verb="*" type="System.Web.Handlers.TraceHandler" validate="True"/>
  <add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="True"/>
  <add path="*.axd" verb="*" type="System.Web.HttpNotFoundHandler" validate="True"/>
  <add path="*.aspx" verb="*" type="System.Web.UI.PageHandlerFactory" validate="True"/>
  <add path="*.ashx" verb="*" type="System.Web.UI.SimpleHandlerFactory" validate="True"/>
  <add path="*.asmx" verb="*" type="System.Web.Services.Protocols.WebServiceHandlerFactory, System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="False"/>
  <add path="*.rem" verb="*" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="False"/>
  <add path="*.soap" verb="*" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="False"/>
  <add path="*.asax" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.ascx" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.master" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.skin" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.browser" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.sitemap" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.dll.config" verb="GET,HEAD" type="System.Web.StaticFileHandler" validate="True"/>
  <add path="*.exe.config" verb="GET,HEAD" type="System.Web.StaticFileHandler" validate="True"/>
  <add path="*.config" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.cs" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.csproj" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.vb" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.vbproj" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.webinfo" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.licx" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.resx" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.resources" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.mdb" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.vjsproj" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.java" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.jsl" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.ldb" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.ad" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.dd" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.ldd" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.sd" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.cd" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.adprototype" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.lddprototype" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.sdm" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.sdmDocument" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.mdf" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.ldf" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.exclude" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.refresh" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*" verb="GET,HEAD,POST" type="System.Web.DefaultHttpHandler" validate="True"/>
  <add path="*" verb="*" type="System.Web.HttpMethodNotAllowedHandler" validate="True"/>
</httpHandlers>

Probably the easiest place to look is the master web.config file, which is where base settings for ASP.NET are declared. This includes <httpHandlers>, e.g.:

<httpHandlers>
  <add verb="*" path="*.rules" type="System.Web.HttpForbiddenHandler" validate="true"/>
  <add verb="*" path="*.xoml" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false"/>
  <add path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false"/>
  <add path="trace.axd" verb="*" type="System.Web.Handlers.TraceHandler" validate="True"/>
  <add path="WebResource.axd" verb="GET" type="System.Web.Handlers.AssemblyResourceLoader" validate="True"/>
  <add path="*.axd" verb="*" type="System.Web.HttpNotFoundHandler" validate="True"/>
  <add path="*.aspx" verb="*" type="System.Web.UI.PageHandlerFactory" validate="True"/>
  <add path="*.ashx" verb="*" type="System.Web.UI.SimpleHandlerFactory" validate="True"/>
  <add path="*.asmx" verb="*" type="System.Web.Services.Protocols.WebServiceHandlerFactory, System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="False"/>
  <add path="*.rem" verb="*" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="False"/>
  <add path="*.soap" verb="*" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="False"/>
  <add path="*.asax" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.ascx" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.master" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.skin" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.browser" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.sitemap" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.dll.config" verb="GET,HEAD" type="System.Web.StaticFileHandler" validate="True"/>
  <add path="*.exe.config" verb="GET,HEAD" type="System.Web.StaticFileHandler" validate="True"/>
  <add path="*.config" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.cs" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.csproj" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.vb" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.vbproj" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.webinfo" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.licx" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.resx" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.resources" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.mdb" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.vjsproj" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.java" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.jsl" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.ldb" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.ad" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.dd" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.ldd" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.sd" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.cd" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.adprototype" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.lddprototype" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.sdm" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.sdmDocument" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.mdf" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.ldf" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.exclude" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*.refresh" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
  <add path="*" verb="GET,HEAD,POST" type="System.Web.DefaultHttpHandler" validate="True"/>
  <add path="*" verb="*" type="System.Web.HttpMethodNotAllowedHandler" validate="True"/>
</httpHandlers>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文