我有一个项目Common,它有一个服务引用.将对Newtonsoft.json(版本6.0.2)的引用添加到具有服务引用的同一项目(Common)和Serializable类ChatLine之后
[Serializable]
public class ChatLine
{
[JsonProperty("L")]
public string LineId { get; set; }
[JsonProperty("CT")]
public DateTime ConversationTimeInUtc { get; set; }
[JsonProperty("S")]
public string SenderId { get; set; }
[JsonProperty("R")]
public IEnumerable<string> Recipients { get; set; }
[JsonProperty("CM")]
public string ConversationMessage { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我更新了服务参考.现在,在构建项目Common时,会弹出以下错误.
构建错误:
错误5命名空间''已包含'AuditStatus'的定义
这是更新服务引用后在Reference.cs中生成的代码
[DataContract]
public enum AuditStatus : byte
{
[EnumMember]
Both,
[EnumMember]
IsAudited,
[EnumMember]
IsNotAudited,
}
// After updating reference, two definitions for above data contract is generated.
/// …Run Code Online (Sandbox Code Playgroud) public static void Main()
{
// testing file name
var fileName =
"\\\\server7\\EmailAttachments\\myfolder\\abc\\2012\\1126\\e85c6b82-edc5-4ce1-9ad0-8025b92d0105-o.dom=38c55279fe168c290fb2b06a312b5d88&b=6f54a59ce903eeaff197f82937de4012.dom=38c55279fe168c290fb2b06a312b5d88&b=6f54a59ce903eeaff197f82937de4012=6f54a59ce903eeaff197f82937de4012.dom=38c55279fe168c290fb2b06a312b5d88&b=6f54a59ce903eeaff197f82937de4012";
var directory = fileName.GetDirectory();
}
public static string GetDirectory(this string fullyQualifiedFileName)
{
return Path.GetDirectoryName(fullyQualifiedFileName); // throwing exception here
}
Run Code Online (Sandbox Code Playgroud)
低于例外
发生System.IO.PathTooLongException HResult = -2147024690
Message =指定的路径,文件名或两者都太长.完全限定的文件名必须少于260个字符,目录名必须少于248个字符.Source = mscorlib
StackTrace:在System.IO.Path.NormalizePath(String path,Boolean fullCheck,Int32 maxPathLength,Boolean expandShortPaths)的System.IO.Path.GetDirectoryName(String path)处于Sameer.FilePathExtension.GetDirectory(String fullyQualifiedFileName)in f :\ Practice Projects\Sameer\Sameer\FilePathExtension.cs:第137行InnerException:
我想知道为什么GetDirectoryName必须依赖于路径或文件名字符限制.
虽然我已将contentlength的限制设置为大约4GB,但最大值如下所示
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="4294967295">
</requestLimits>
</requestFiltering>
</security>
<httpRuntime targetFramework="4.5" requestValidationMode="2.0"
requestPathInvalidCharacters="" maxRequestLength="5024000" executionTimeout="3600" />
Run Code Online (Sandbox Code Playgroud)
我收到了以下错误
HTTP错误400.0 - 错误请求
ASP.NET在URL中检测到无效字符.
我找到了一个链接,提到了这种行为的原因
如果应用程序在NET 4.5集成管道下运行,则上传将无法在2G以上运行,并且IIS将发送以下错误:"HTTP 400.0 - 错误请求ASP.NET在URL中检测到无效字符.".
当使用集成管道时,我们通过webengine代码(webengine4!MgdGetRequestBasics),它不支持超过2 GB的内容长度,并引发System.ArithmeticException异常,随后导致HTTP 400错误.使用经典管道,我们不使用webengine4,而是使用旧的ASPNET_ISAPI模型,我们没有遇到上述问题.
想在IIS 10和.net framework 4.5中询问它是否仍然有效.
有没有可以设置的设置来解决这个问题?
并行调用api(4 次),在事务中执行批量大小为 10K 的文档的新插入时,经常出现WriteConflict 错误。但如果插入批量大小设置为 2K,则运行良好。不确定我需要调整哪个参数,以便插入工作对于 10k 批量大小没有问题
MongoDB服务器版本:4.4.0
不确定这是否与此有关https://jira.mongodb.org/browse/SERVER-53464
这是当 mongo loglevel 设置为 1 时的 mongo 日志
{"t":{"$date":"2021-01-23T17:23:40.838+00:00"},"s":"I", "c":"COMMAND", "id":51803, "ctx":"conn42","msg":"Slow query","attr":{"type":"command","ns":"mydb.mycollection","command":{"insert":"mycollection","ordered":false,"$db":"mydb","lsid":{"id":{"$uuid":"a0beb5f8-ed4c-4b64-8971-719178b3a598"}},"$clusterTime":{"clusterTime":{"$timestamp":{"t":1611422612,"i":10000}},"signature":{"hash":{"$binary":{"base64":"H3DsiEiy4CMrRNvWqbIJQMbHl0c=","subType":"0"}},"keyId":6870929147875557381}},"txnNumber":4,"startTransaction":true,"autocommit":false},"ninserted":10000,"keysInserted":30000,"numYields":0,"reslen":230,"locks":{},"storage":{"data":{"bytesRead":1661221,"timeReadingMicros":3201739}},"protocol":"op_msg","durationMillis":3741}}
{"t":{"$date":"2021-01-23T17:23:40.838+00:00"},"s":"D1", "c":"QUERY", "id":22790, "ctx":"conn42","msg":"Received interrupt request for unknown op","attr":{"opId":28178}}
{"t":{"$date":"2021-01-23T17:23:40.909+00:00"},"s":"I", "c":"TXN", "id":51802, "ctx":"conn42","msg":"transaction","attr":{"parameters":{"lsid":{"id":{"$uuid":"a0beb5f8-ed4c-4b64-8971-719178b3a598"},"uid":{"$binary":{"base64":"Zx/+1Rn/RW/eLwwG9xqjQAzGuq4fRkYljdz5CIhAbaw=","subType":"0"}}},"txnNumber":4,"autocommit":false,"readConcern":{"provenance":"implicitDefault"}},"readTimestamp":"Timestamp(0, 0)","ninserted":10000,"keysInserted":30000,"terminationCause":"aborted","timeActiveMicros":3810904,"timeInactiveMicros":2702,"numYields":0,"locks":{"ReplicationStateTransition":{"acquireCount":{"w":2}},"Global":{"acquireCount":{"w":1}},"Database":{"acquireCount":{"w":1}},"Collection":{"acquireCount":{"w":1}},"Mutex":{"acquireCount":{"r":46}}},"storage":{"data":{"bytesRead":1661221,"timeReadingMicros":3201739}},"wasPrepared":false,"durationMillis":3813}}
{"t":{"$date":"2021-01-23T17:23:40.910+00:00"},"s":"D1", "c":"STORAGE", "id":22411, "ctx":"conn42","msg":"Slow WT transaction. Lifetime of SnapshotId {getSnapshotId_toNumber} was {transactionTime}ms","attr":{"getSnapshotId_toNumber":78620,"transactionTime":3813}}
{"t":{"$date":"2021-01-23T17:23:40.933+00:00"},"s":"D1", "c":"COMMAND", "id":21962, "ctx":"conn42","msg":"Assertion while executing command","attr":{"command":"commitTransaction","db":"admin","commandArgs":{"commitTransaction":1,"$db":"admin","lsid":{"id":{"$uuid":"a0beb5f8-ed4c-4b64-8971-719178b3a598"}},"$clusterTime":{"clusterTime":{"$timestamp":{"t":1611422620,"i":10000}},"signature":{"hash":{"$binary":{"base64":"+r9TOIIR/J8dXRvrPyF0urUeWJA=","subType":"0"}},"keyId":6870929147875557381}},"txnNumber":4,"autocommit":false},"error":"WriteConflict: WriteConflict error: this operation conflicted with another operation. Please retry your operation or multi-document transaction."}}
{"t":{"$date":"2021-01-23T17:23:40.933+00:00"},"s":"I", "c":"COMMAND", …Run Code Online (Sandbox Code Playgroud) 示例字符串
"[] [ds*[000112]] [1448472995] sample string [1448472995] ***";
Run Code Online (Sandbox Code Playgroud)
正则表达式应该匹配
[1448472995] [1448472995]
Run Code Online (Sandbox Code Playgroud)
[000112]因为有外方括号,所以不应该匹配.
目前,我有这个正则表达式是匹配[000112] 以及
const string unixTimeStampPattern = @"\[([0-9]+)]";
Run Code Online (Sandbox Code Playgroud) 我在生产中遇到此错误。不知道到底是什么原因造成的。
OnSubscriptionError :
Microsoft.Exchange.WebServices.Data.ServiceResponseException:
The specified subscription was not found.
Run Code Online (Sandbox Code Playgroud)
现在我想在我的开发环境中模拟行为。
我已经订阅了event Connection.OnSubscriptionError,我的事件处理程序是OnSubscriptionError。现在我要测试处理程序。为此,我想要某种触发事件的方式,我很难解决。
我已尝试在应用程序运行时关闭Exchange主机服务,但这并不会启动OnsubscriptionError Event。
我想知道以下代码在OnsubscriptionError event被触发时是否有效。还是在创建连接之前必须重新创建Subscription对象。
这是示例代码:
Subscription =_exchangeService.SubscribeToStreamingNotifications(
new FolderId[] { WellKnownFolderName.Inbox },
EventType.NewMail);
CreateStreamingSubscription(_exchangeService, Subscription);
private void CreateStreamingSubscription(ExchangeService service,
StreamingSubscription subscription)
{
// public StreamingSubscriptionConnection(ExchangeService service, int lifetime) lifetime is in minutes and 30 mins is the maximum time till which
// the connection can be open.
Connection = new StreamingSubscriptionConnection(service, 30);
Connection.AddSubscription(subscription);
Connection.OnNotificationEvent += OnNotificationEvent;
Connection.OnSubscriptionError += …Run Code Online (Sandbox Code Playgroud) 有没有办法从UNC路径获取本地路径?
例如:\\ server7\hello.jpg应该给我D:\ attachments\hello.jpg
在应用Windows文件名和完整路径长度限制后,我试图将附件保存到UNC路径.在这里,我通过将UNC路径长度作为参考来应用这些限制.但是本地路径长度比UNC路径长,我想因为这个我得到以下异常.
发生System.IO.PathTooLongException HResult = -2147024690
Message =指定的路径,文件名或两者都太长.完全限定的文件名必须少于260个字符,目录名必须少于248个字符.Source = mscorlib
StackTrace:System.IO.Path.NormalizePath(String path,Boolean fullCheck,Int32 maxPathLength,Boolean expandShortPaths)的System.IO.PathHelper.GetFullPathName()at System.IO.Path.NormalizePath(String path,Boolean fullCheck) System.IO.FileStream.Init上的,Int32 maxPathLength)(String路径,FileMode模式,FileAccess访问,Int32权限,Boolean useRights,FileShare共享,Int32 bufferSize,FileOptions选项,SECURITY_ATTRIBUTES secAttrs,String msgPath,Boolean bFromProxy,Boolean useLongPath,Boolean checkHost)在System.IO.FileStream..ctor(String路径,FileMode模式,FileAccess访问,FileShare共享,Int32 bufferSize,FileOptions选项,String msgPath,Boolean bFromProxy)处于System.IO.FileStream..ctor(String path,FileMode)模式)在Presensoft.JournalEmailVerification.EmailVerification.DownloadFailedAttachments(EmailMessage msg,JournalEmail journalEmail)中的D:\ Source\ProductionReleases\Release_8.0.7.0\Email Archiving\Presensoft.JournalEmailVerification\EmailVer ification.cs:第630行InnerException:
我有这两个接口
/// <summary>
/// Represents an interface that knows how one type can be transformed into another type.
/// </summary>
/// <typeparam name="TInput"></typeparam>
/// <typeparam name="TOutput"></typeparam>
public interface ITransformer<in TInput,out TOutput>
{
TOutput Transform(TInput input);
}
public interface ITransform
{
TOutput Transform<TInput,TOutput>(ITransformer<TInput, TOutput> transformer);
}
Run Code Online (Sandbox Code Playgroud)
我有一个类想要实现这样的ITranform.
public class MessageLogs :ITransform
{
// But I am am not able to implement the ITransform interface like this
// MessageLogs is getting binded in the param but not getting binded to
// TInput …Run Code Online (Sandbox Code Playgroud) 我只是从詹金斯开始。我正在尝试在分支/主服务器上运行构建。
我所得到的只是没有计划为分支机构构建:主
这是日志:
Started by timer
[Sun Mar 05 18:23:43 NPT 2017] Starting branch indexing...
Connecting to https://bitbucket.org using sameerkattel@hotmail.com/****** (sameer_kattel)
Repository type: Git
Looking up sameer_kattel/protected-consumer for branches
Checking branch single_page_app from sameer_kattel/protected-consumer
Checking branch master from sameer_kattel/protected-consumer
‘Jenkinsfile’ found
Met criteria
Changes detected: master (null ? b2e24fc7a3a3c68f84dddf69d2cedc79f8478bf3)
Did not schedule build for branch: master
Checking branch enable_cors_response_lamda from sameer_kattel/protected-consumer
Looking up sameer_kattel/protected-consumer for pull requests
[Sun Mar 05 18:23:45 NPT 2017] Finished branch indexing. Indexing took 2.1 sec …Run Code Online (Sandbox Code Playgroud) 我已按照此链接运行dnx控制台应用程序.我创建了两个文件Program.cs和project.json,其中包含链接中提到的内容
这是我执行的命令序列
F:\first-dnx> dnvm list
Active Version Runtime Architecture OperatingSystem Alias
------ ------- ------- ------------ --------------- -----
1.0.0-beta6 clr x86 win
1.0.0-beta6 coreclr x64 win
* 1.0.0-beta8-15530 clr x86 win default
F:\first-dnx> dnu restore
Microsoft .NET Development Utility CLR-x86-1.0.0-beta8-15530
Restoring packages for F:\first-dnx\project.json
CACHE https://www.myget.org/F/aspnetvnext/api/v2/
CACHE https://www.nuget.org/api/v2/
Writing lock file F:\first-dnx\project.lock.json
Restore complete, 490ms elapsed
NuGet Config files used:
C:\Users\sam\AppData\Roaming\NuGet\NuGet.Config
Feeds used:
https://www.myget.org/F/aspnetvnext/api/v2/
https://www.nuget.org/api/v2/
F:\first-dnx> dnu build
Run Code Online (Sandbox Code Playgroud)
该项目已成功构建,但当我尝试运行以下应用程序时,抛出异常
F:\first-dnx> dnx . run
System.InvalidOperationException: Unable to load application or …Run Code Online (Sandbox Code Playgroud) 命令:Get-AzureADUser [-Filter] 命令
msdn 说参数 -Filter 指定 oData v3.0 过滤器语句。此参数控制返回哪些对象。
如何设置过滤器以获得与 Azure 模块 v1 命令相同的结果
Get-MsolUser -All| Where-Object {$_.isLicensed -eq "True"}| Select-Object UserPrincipalName -ExpandProperty Licenses|Select-Object UserPrincipalName -ExpandProperty ServiceStatus|Where-Object {$_.ProvisioningStatus -eq "Success" -and $_.ServicePlan.ServiceName -like "MCO*"}|select UserPrincipalName -Unique
Run Code Online (Sandbox Code Playgroud)
我到处搜索以找到设置过滤器的正确示例,但找不到,我最终到了这里。我基本上是在尝试将我的 Azure 模块 v1 命令转换为 Azure 模块 v2 命令。
我在一个DLL中引用了一个exe文件.在DEBUG模式下运行时,一切运行正常,但在Release模式下运行时,抛出异常
System.BadImageFormatException occurred
HResult=-2147024885
Message=Could not load file or assembly 'Presensoft.InlineMarker, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Source=Presensoft.ApplicationServer
FileName=Presensoft.InlineMarker, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
FusionLog==== Pre-bind state information ===
LOG: DisplayName = Presensoft.InlineMarker, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///F:/PresensoftNewTrunk/Trunk/Email Archiver/EmailService/Presensoft.ApplicationServerHost/bin/Release/
LOG: Initial PrivatePath = NULL
Calling assembly : Presensoft.ApplicationServer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: …Run Code Online (Sandbox Code Playgroud)