简体   繁体   English

如何以编程方式访问Windows Server 2003上的文件

[英]How to access files on the windows server 2003 programmatically

I'm trying to build logviewer for logfiles stored on our server.I know about the logviewers available on codeplex. 我正在尝试为存储在我们服务器上的日志文件构建logviewer。我知道codeplex上可用的logviewer。 But I'm looking to build something of my own. 但是我正在寻找自己的东西。 Here's what I need to do first and foremost. 这是我首先需要做的。 The log files are stored on server with address \\windows server address\\LogFiles. 日志文件存储在地址为\\ windows服务器地址\\ LogFiles的服务器上。 Over here there are various folders with names W3SVC69773105,W3SVC1208646085. 在这里有名称为W3SVC69773105,W3SVC1208646085的各种文件夹。 Now I can't make head and shoulders of this folder name but each folder represents an application. 现在,我无法确定此文件夹的名称,但每个文件夹代表一个应用程序。 Inside each folder there are log files for each day. 每个文件夹中每天都有日志文件。 I need to be able to get the latest file from the server, and then do parsing on it. 我需要能够从服务器获取最新文件,然后对其进行解析。 I want to know how can I access this file located on server programmatically from my local machine. 我想知道如何从本地计算机以编程方式访问服务器上的该文件。

Insofar as the folder names, it is actually pretty easy to generate them presuming you can access the IIS api. 就文件夹名称而言,假定您可以访问IIS api,实际上很容易生成它们。 You see, W3CSVC4572 maps to IIS site ID #4572. 您会看到W3CSVC4572映射到IIS站点ID#4572。 So, you should have a log folder for each IIS site ID in a rather predictable pattern. 因此,您应该以一种相当可预测的模式为每个IIS站点ID创建一个日志文件夹。

I'll resist my urge to ask why you are in fact reinventing the wheel. 我忍不住要问,为什么您实际上在重新发明轮子呢? Except log parsing is alot less sexy a technology than wheels . 除了日志解析之外,技术比轮子少很多。 . .

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM