【发布时间】:2015-03-25 00:14:54
【问题描述】:
我有幸进一步开发了一个用 C# 编写的内部控制台应用程序。此应用程序的目的是将多个文件从一台服务器同步到另一台服务器,基本上是将文件从一台服务器复制到另一台服务器。该应用程序适用于最大 4 MB 的文件,除了日志文件之外,我在应用程序本身的任何地方都找不到它,它将文件大小限制为 4 MB。
此控制台应用程序是存储用户创建的表单的 Web 应用程序的一部分。我已设法限制 web 应用程序以允许文件大小不超过 100 MB 并且可以正常工作,但同步应用程序不会将较大的文件从仓库传输到另一台服务器上的相应位置。
不幸的是,除了显示传输正常的文件(不超过 4 MB)的日志外,我没有其他日志。调试应用程序是不行的,因为它只在服务器上运行,我不能让它在我的本地机器上工作。
因此,我的问题是,是否可以在 app.config 文件中设置任何内容以允许应用程序也同步大于 4 MB 的文件?
在这个大项目的 webapplication 部分,我使用了以下代码:
<system.web>
<httpRuntime maxRequestLength="102400" executionTimeout="1200"/>
</system.web>
但由于这部分不是网络应用程序,它(似乎)不关心那行配置。
这是控制台同步应用的配置文件:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="SynchConfiguration" value="C:\Documents and Settings\My Documents\Visual Studio 2010\Projects\DepotSynch\Depot.Synch\DepotSynchConfiguration.xml"/>
<add key="SynchLog" value="C:\Documents and Settings\My Documents\Visual Studio 2010\Projects\DepotSynch\Depot.Synch\DepotSynchLOG.txt"/>
<!-- Int Size in MB -->
<add key="MaxLogFileSize" value="4"/>
<!-- SHS Web Service API Configuration -->
<add key="Status" value="test"/>
<add key="From" value="1234567890"/>
<!-- Identification Nummer -->
<add key="To" value="1234567890.web"/>
<add key="CertLocation" value="certificate\test\test.p12"/>
<!-- placeing of certet i filsystemet -->
<add key="CertPwd" value="test234test"/>
<!-- cert -->
<!-- <add key="ShsUrl" value="Is set ini DepotSynchConfiguration.xml for each environment"/> -->
<!-- URL to Shs Service -->
<add key="ConnectByCertAndPwd" value="true"/>
<!-- True/False - for certificate -->
<add key="SendFileBySHS" value="false"/>
<!-- For test. Won't send the file/s. -->
</appSettings>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="MyWsHttpBinding" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:50232/Depot.svc" binding="wsHttpBinding" bindingConfiguration="MyWsHttpBinding" contract="DepotReleaseServiceReference.IDepot" name="MyWsHttpBinding">
<identity>
<servicePrincipalName value="
 " />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
很遗憾,由于他在大约 2 年前辞去这里的工作,因此我无法就这件事向原始开发人员寻求帮助。
【问题讨论】:
-
看看这个问题,好像差不多:stackoverflow.com/questions/11068612/….
-
感谢您提供的提示和指向类似页面的链接,我尝试了您链接 @NathanTaylor 但它没有用,但我并没有说这是错误的,但我会尝试重新启动服务器运行此服务以查看它是否会采用新的 app.config 文件而不是 chached 文件。
-
您好,感谢您的帮助和输入@Nathan,请在下面的答案中查看我的评论:)
标签: c# xml console-application app-config