小编Gui*_*ume的帖子

AppDomain和MarshalByRefObject的生命周期:如何避免RemotingException?

当MarshalByRef对象从AppDomain(1)传递到另一个(2)时,如果你在第二个AppDomain(2)中调用方法之前等待6分钟,你将得到一个RemotingException:

System.Runtime.Remoting.RemotingException:对象[...]已断开连接或在服务器上不存在.

有关此问题的一些文档:

如果我错了,请纠正我:如果InitializeLifetimeService返回null,那么当AppDomain 2被卸载时,该对象只能在AppDomain 1中收集,即使收集了代理?

有没有办法禁用生命周期并保持代理(在AppDomain 2中)和对象(在AppDomain1中)保持活动状态,直到代理完成为止?也许与ISponsor ......?

.net c# remoting appdomain object-lifetime

56
推荐指数
4
解决办法
3万
查看次数

在Visual Studio 2013中更改编译器错误语言

我安装了英文版的Visual Studio 2013.GUI是英文版,但编译错误是法文版.当我想谷歌出错时,这是一场噩梦......

如何将C#编译器输出语言切换为英语?

configuration compiler-errors visual-studio-2013

9
推荐指数
3
解决办法
7661
查看次数

Monotouch打开文档 - UIDocumentInterationController

我想在我用iotouch编写的iphone应用程序上打开一个文档 - 即在默认的PDF查看器中启动PDF文件.

我想我应该使用UIDocumentInterationController?

任何人对此都有任何想法..

我在viewcontroller上放了以下内容(带工具栏)

但它不起作用:-(它什么都不做!

string s = string.Format("{0}",strFilePath);

NSUrl ns = NSUrl.FromFilename (s);   

UIDocumentInteractionController PreviewController =
   UIDocumentInteractionController.FromUrl(ns);
PreviewController.Delegate =  new UIDocumentInteractionControllerDelegateClass();
PreviewController.PresentOpenInMenu(btnOpen,true);
Run Code Online (Sandbox Code Playgroud)

  public class UIDocumentInteractionControllerDelegateClass : UIDocumentInteractionControllerDelegate
                {
                     public UIViewController FileViewController = new UIViewController();
                    public UIDocumentInteractionControllerDelegateClass ()
                    {
                    }

                    public override UIViewController ViewControllerForPreview (UIDocumentInteractionController controller)
                    {
                        return FileViewController;    
                    }

                    public override UIView ViewForPreview (UIDocumentInteractionController controller)
                    {
                        return FileViewController.View;
                    }
                }
Run Code Online (Sandbox Code Playgroud)

iphone cocoa-touch xamarin.ios

5
推荐指数
1
解决办法
2506
查看次数

.Net4,Monitor.Enter(lockObject,acquiredLock)

在.Net4中,Monitor.Enter(Object)被标记为已废弃:

[ObsoleteAttribute("This method does not allow its caller to reliably release the lock.  Please use an overload with a lockTaken argument instead.")]
public static void Enter(
    Object obj
)
Run Code Online (Sandbox Code Playgroud)

并且有一个新方法Monitor.Enter(lockObject,acquiredLock)具有以下用法:

bool acquiredLock = false;

try
{
    Monitor.Enter(lockObject, ref acquiredLock);

    // Code that accesses resources that are protected by the lock.

}
finally
{
    if (acquiredLock)
    {
        Monitor.Exit(lockObject);
    }
}
Run Code Online (Sandbox Code Playgroud)

我曾经这样做过:

Monitor.Enter(lockObject);
try
{

    // Code that accesses resources that are protected by the lock.
}
finally …
Run Code Online (Sandbox Code Playgroud)

.net locking thread-safety

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

如何限制azure blob容器的大小?

在我的应用程序中,Web服务向客户端发送共享访问签名(对容器的写权限),以便它可以上载文件.

有没有办法限制上传内容的大小(例如1Gb)?理想的解决方案是容器的自定义大小限制.否则,它可能是共享访问签名的限制.

如果该功能在blob上可用,我还可以更改我的应用程序以在各个blob上发送共享访问签名.

azure azure-storage azure-storage-blobs

3
推荐指数
2
解决办法
9037
查看次数