草庐IT

Application-Name

全部标签

c# - "An assembly with the same simple name has already been imported"没有重复引用的错误

我收到以下错误:errorCS1704:Anassemblywiththesamesimplename'Interop.xxx.dll,Version=1.0.0.0,Culture=neutral,PublicKeyToken=nullhasalreadybeenimported.Tryremovingoneofthereferencesorsignthemtoenableside-by-side.我所看到的一切都表明我引用了两个同名的程序集,我需要删除其中一个。但是,我已经检查过并且只引用了一次。这也仅在我使用msbuild从我的开发箱上的命令行构建时发生。如果我通过VisualS

c# - 无法处理消息,因为内容类型 'application/json; charset=utf-8' 不是预期的类型 'text/xml; charset=utf-8'

我在通过ajaxjson调用WCF服务时收到上述响应。我的调用代码是:$(document).ready(function(){$.ajax({type:"POST",contentType:"application/json;charset=utf-8",url:"http://localhost:90/WebServices/UserService.svc/Calculate",data:"{}",timeout:10000,dataType:"json",success:function(response){alert(response)},error:function(xhr,

c# - Image.Save 崩溃 : {"Value cannot be null.\r\nParameter name: encoder"}

我正在尝试将图像保存到MemoryStream中,但在某些情况下会失败。代码如下:以下代码成功:Imageimg=Bitmap.FromStream(fileStream);MemoryStreamms=newMemoryStream();img.Save(ms,img.RawFormat);//Thissucceeds.以下代码失败:Imageimg=Bitmap.FromStream(fileStream);Imagethumb=img.GetThumbnailImage(thumbWidth,thumbHeight,null,System.IntPtr.Zero);MemoryS

c# - 具有路由属性的模糊 Controller 名称 : controllers with same name and different namespace for versioning

我正在尝试添加API版本控制,我的计划是为不同命名空间中的每个版本创建一个Controller。我的项目结构是这样的(注意:每个版本没有单独的区域)Controllers||---Version0||||-----ProjectController.cs||-----HomeController.cs||---Version1||-----ProjectController.cs|-----HomeController.cs我正在为路由使用RoutingAttribute。因此,Version0中的ProjectController具有路由功能namespaceMyProject.Co

c# - 在 WPF 中获取 "<Property Name> was already registered by "<控件名称>"错误

我在WPF中有一个用户控件,它绑定(bind)到一个依赖属性。当我尝试编译应用程序时,出现“属性名称”已由“控件名称”注册的错误,设计器显示“无法创建“用户控件”的实例”错误。这是我的简单控件的样子:ExampleUserControl.xaml:ExampleUserControl.xaml.cs:publicpartialclassExampleUserControl:UserControl{publicDependencyPropertySomeStringValueProperty=DependencyProperty.Register("SomeStringValue",ty

c# - 不能包含 Microsoft.Security.Application?

我不能包含Microsoft.Security.ApplicationusingMicrosoft.Security.Application;给出这个错误:Thetypeornamespacename'Security'doesnotexistinthenamespace'Microsoft'(areyoumissinganassemblyreference?)是的,我点击了Bin->AddReference...->AntiXSSLibrary.dll并将其添加到包含AntiXSSLibrary.xml的Bin文件夹中。我重建了整个网站,但仍然一无所获。我正在使用ASP.NET3.5

c# - 全局异常过滤器或 Application_Error 都没有捕获未处理的异常

我有一个名为LogErrorAttribute的全局异常过滤器:publicclassLogErrorAttribute:IExceptionFilter{privateILogUtilslogUtils;publicvoidOnException(ExceptionContextfilterContext){if(this.logUtils==null){this.logUtils=StructureMapConfig.Container.GetInstance();}this.logUtils.LogError(HttpContext.Current.User.Identity.G

c# - SharePoint 错误 : Web application at xxxx could not be found

当我尝试执行这段代码时:SPSitesiteCollection=newSPSite(@"http://sp-devxxx:10000/");它抛出以下错误:TheWebapplicationathttp://sp-devxxx:10000couldnotbefound.VerifythatyouhavetypedtheURLcorrectly.IftheURLshouldbeservingexistingcontent,thesystemadministratormayneedtoaddanewrequestURLmappingtotheintendedapplication.我可以

c# - 将 Application Insights 与单元测试结合使用?

我有一个MVC网络应用程序,我正在使用SimpleInjectorforDI。单元测试几乎覆盖了我所有的代码。但是,现在我已经在一些Controller中添加了一些遥测调用,我在设置依赖项时遇到了问题。遥测调用用于将指标发送到MicrosoftAzure托管的ApplicationInsights服务。该应用程序不在Azure中运行,只是一个带有ISS的服务器。AI门户告诉您有关应用程序的各种信息,包括您使用遥测库发送的任何自定义事件。因此,Controller需要一个Microsoft.ApplicationInsights.TelemetryClient的实例,它没有接口(inte

c# - LINQ to Entities Group By 表达式给出 'Anonymous type projection initializer should be simple name or member access expression'

我在这个表达式中遇到了上述错误:varaggregate=fromtinentities.TraceLinesjoinminentities.MethodNames.Where("it.NameLIKE@searchTerm",newObjectParameter("searchTerm",searchTerm))ont.MethodHashequalsm.MethodHashwhere(t.CallTypeId&(int)types)==t.CallTypeId&&t.UserSessionProcessId==m_SessionIdgrouptbym.Nameintodselect