小编Sam*_*Sam的帖子

打印Windows客户端(非Web应用程序)的最佳方式?

从c#/ .net打印东西的最佳方法是什么?

问题在于单页以及包含大量页面的报告.

获得最常见的打印库列表会很棒,其中包含每个打印库的主要功能和陷阱.

请更新标准Windows客户端(或服务器),而不是网络应用程序.

.net c# printing

12
推荐指数
1
解决办法
3万
查看次数

在Windows Phone 7上获取汇编版本

在我的c#应用程序中,我通常使用以下代码获取版本(以显示客户):

System.Reflection.Assembly.GetExecutingAssembly().GetName().Version
Run Code Online (Sandbox Code Playgroud)

这在Windows Phone 7中不起作用(它会挂起模拟器,而电话崩溃对MS来说是禁忌).

那么,我如何在Windows Phone 7设备上获得执行的版本?

[更新]如下面的评论中所述,在wp7应用程序中调用GetName()似乎是个问题.

reflection windows-phone-7

12
推荐指数
1
解决办法
4801
查看次数

在.net中读取大型XML文档

我需要使用.net文件读取大型xml,这些文件很容易达到几GB.

我试图使用XDocument,但它只是在我尝试加载文档时抛出一个System.OutOfMemoryException.

读取大尺寸XML文件的最佳方法是什么?

.net c# xml-parsing

12
推荐指数
2
解决办法
1万
查看次数

如何在VS2017最终定位多个框架?

对于ASP.NET Core,我可以在一个Project.json中定位多个框架(例如netcoreapp1.1dnx451):

"frameworks": {
   "netcoreapp1.1": {
     "dependencies": {
       "Microsoft.NETCore.App": {
         "version": "1.1.0",
         "type": "platform"
       }
     },
     "imports": [
       "dotnet5.6",
       "portable-net45+win8"
     ]
   },
   "dnx451": {}
 },
Run Code Online (Sandbox Code Playgroud)

在Visual Studio 2017的最终版本中,我只能定位netcoreapp1.1或者dnx451,但我认为无法同时定位两者.

我尝试直接编辑csproj文件以通过设置<TargetFramework>netcoreapp1.1;dnx451</TargetFramework>或者甚至 <TargetFrameworks>netcoreapp1.1;dnx451</TargetFrameworks>在Visual Studio中添加第二个框架而由于不支持的框架而导致错误.

那么,如何同时针对netcoreapp1.1dnx451在一个项目在Visual Studio 2017的最终版本?

asp.net-core visual-studio-2017

12
推荐指数
1
解决办法
7076
查看次数

如何跟踪WCF邮件大小?

我正在使用WCF,并希望看到我发送/接收的消息数量,以及这些消息的大小.

我尝试了激活的WCF跟踪,最终得到了一个真正的巨大跟踪文件,但我发现无法从中提取简单的消息大小.

肯定有办法得到这个吗?也许我错过了追踪中的一些参数?

debugging wcf

11
推荐指数
2
解决办法
5972
查看次数

几个WCF服务可以共享一个公共BaseAddress吗?

我有一个包含几个WCF服务的程序集,每个服务都有自己的合同.这一切都很好.app.config中服务的服务配置如下所示:

<services>
  <service behaviorConfiguration="WcfService.AlyzaServiceBehavior"
    name="Sam.Alyza.WcfService.ServiceWebsites">
    <endpoint address="" binding="netTcpBinding" contract="Sam.Alyza.WcfInterface.IServiceWebsites">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="net.tcp://localhost:8731/Design_Time_Addresses/SamAlyza/Websites/" />
      </baseAddresses>
    </host>
  </service>
  <service behaviorConfiguration="Sam.Alyza.WcfService.LogReaderServiceBehavior"
    name="Sam.Alyza.WcfService.ServiceLogReader">
    <endpoint address="" binding="netTcpBinding" contract="Sam.Alyza.WcfInterface.IServiceLogReader">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="net.tcp://localhost:8731/Design_Time_Addresses/SamAlyza/LogReader/" />
      </baseAddresses>
    </host>
  </service>
  <service behaviorConfiguration="Sam.Alyza.WcfService.ServiceSystemverwaltungBehavior"
    name="Sam.Alyza.WcfService.ServiceSystemverwaltung">
    <endpoint address="" binding="netTcpBinding" contract="Sam.Alyza.WcfInterface.IServiceSystemverwaltung">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="net.tcp://localhost:8731/Design_Time_Addresses/SamAlyza/Systemverwaltung/" />
      </baseAddresses>
    </host>
  </service> …
Run Code Online (Sandbox Code Playgroud)

wcf app-config endpoints base-address

11
推荐指数
1
解决办法
2万
查看次数

如何调试.net垃圾收集?

是否可以查看调用GC.Collect()时收集的所有.net对象?

我需要看看哪些对象仍在内存中而不是回收,所以我可以找到回收对象应该手动完成的地方,但程序员已经忘记了.
我不想调用GC.Collect,因为有人在某处忘记了处理阻塞某些句柄的对象.

.net debugging garbage-collection

10
推荐指数
1
解决办法
3553
查看次数

WPF:是否可以使用GeometryDrawing渲染圆圈?

我有一个类似这样的GeometryDrawing:

<DrawingImage x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type wpfhlp:FokusGroupBox},ResourceId=IconTest}">
  <DrawingImage.Drawing>
    <DrawingGroup>
      <GeometryDrawing Brush="Black" Geometry="M0,260 L0,600 L110,670 L110,500 L190,550 L190,710 L300,775 L300,430 L150,175"/>
    </DrawingGroup>
  </DrawingImage.Drawing>
</DrawingImage>
Run Code Online (Sandbox Code Playgroud)

现在我想画一个圆圈,但我只能找到移动的命令,画一条线,没有画一个圆圈.

有没有办法让GeometryDrawing画一个圆圈?

wpf geometry drawing

10
推荐指数
2
解决办法
1万
查看次数

棱镜:在加载到某个区域的ViewModel之间共享数据?

我有一个包含TabControl的View绑定到区域"CustomerRegion".

我有一些标记为[ViewExport(RegionName ="CustomerRegion")]的View/ViewModel.

这些项成功加载到TabControl中.

但是现在我需要这些TabItems来共享这个TabControl中的一些数据(不能是全局的,因为它们可能同时打开两个或更多个).

有关这些TabItem如何在不离开MVVM/MEF的情况下共享数据的任何想法?

prism mef mvvm

10
推荐指数
1
解决办法
8807
查看次数

刷新ASP.Net核心标识中的用户cookie票证

在ASP.NET Core Web应用程序的控制器中,我想刷新存储在客户端上的cookie票证中的用户和声明.

客户端经过身份验证和授权,ASP.NET Core Identity将此信息存储在cookie票证中 - 现在在某些Controller操作中我想刷新cookie中的数据.

SignInManager有一个函数来刷新RefreshSignInAsync,但它不接受HttpContext.User作为参数.

[HttpPost("[action]")]
[Authorize]
public async Task<IActionResult> Validate()
{
  // todo: update the Client Cookie
  await _signInManager.RefreshSignInAsync(User); // wrong type
}
Run Code Online (Sandbox Code Playgroud)

如何刷新cookie?

c# asp.net-identity asp.net-core

10
推荐指数
1
解决办法
5953
查看次数