小编Moh*_*rag的帖子

StackExchange.Redis和StackExchange.Redis.StrongName有什么区别?

在我关注如何在Azure门户中使用Redis缓存的Azure 文档时,我注意到了这个注释:

如果您更喜欢使用StackExchange.Redis客户端库的强命名版本,请选择StackExchange.Redis.StrongName; 否则选择StackExchange.Redis.

什么是强名?什么是过程和缺点?如何在我的申请中决定我是否需要它?

azure redis stackexchange.redis

32
推荐指数
2
解决办法
8454
查看次数

我为什么要使用Any方法而不是Count?

可能重复:
哪种方法表现更好:.Any()vs .Count()> 0?

我只是想知道为什么我应该使用Any()而不是Count()?,如果我们采用msdn示例:

class Pet
{
    public string Name { get; set; }
    public int Age { get; set; }
}
class Person
{
    public string LastName { get; set; }
    public Pet[] Pets { get; set; }
}

public static void AnyEx2()
{
    List<Person> people = new List<Person>
        { new Person { LastName = "Haas",
                       Pets = new Pet[] { new Pet { Name="Barley", Age=10 },
                                          new Pet { Name="Boots", Age=14 …
Run Code Online (Sandbox Code Playgroud)

c# linq asp.net linq-to-entities entity-framework

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

什么是DWASMod.dll?

当我使用VS2015远程配置我的Web应用程序并查看结果时,我发现其中很多都DWASMod.dll消耗了我的资源.

我搜索了这个dll,找不到任何资源谈论它.有人可以解释这个dll是什么来的吗?

在此输入图像描述

asp.net-mvc profiling azure visual-studio-2015

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

ActionExecutingContext和HttpActionContext之间的差异

当我向api控制器添加过滤器属性时,由于使用它不起作用ActionExecutingContext.当我找到我必须使用的解决方案时,HttpActionContext它工作正常.那么它们之间的主要区别是什么?

c# api asp.net-mvc-4

8
推荐指数
1
解决办法
920
查看次数

突然从实体框架中获取异常

我不时收到此异常:

“用户”上的“电子邮件”属性无法设置为“System.Int64”值。您必须将此属性设置为“System.String”类型的非空值。方法消息:, LogException: System.InvalidOperationException: 'User' 上的 'Email' 属性无法设置为 'System.Int64' 值。您必须将此属性设置为“System.String”类型的非空值。在 System.Data.Entity.Core.Common.Internal.Materialization.Shaper.ErrorHandlingValueReader 1.GetValue(DbDataReader reader, Int32 ordinal) at lambda_method(Closure , Shaper ) at System.Data.Entity.Core.Common.Internal.Materialization.Shaper.HandleEntityAppendOnly[TEntity](Func2constructEntityDelegate, EntityKey entityKey, EntitySet entitySet) 在 lambda_method(Closure , Shaper ) 在 System.Data.Entity.Core.Common.Internal.Materialization.Coordinator 1.ReadNextElement(Shaper shaper) at System.Data.Entity.Core.Common.Internal.Materialization.Shaper1.SimpleEnumerator.MoveNext() at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source) at Project。

我在 MVC 项目中使用 Asp.net Identity。

我的用户类像:

public class User : IdentityUser<long, IdentityConfig.UserLogin, IdentityConfig.UserRole, IdentityConfig.UserClaim>
{
    public async Task<ClaimsIdentity> GenerateUserIdentityAsync(IdentityConfig.CustomUserManager manager)
    {
        // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
        var userIdentity = await …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc entity-framework azure asp.net-identity azure-sql-database

6
推荐指数
1
解决办法
490
查看次数

在“停止”模式下部署 azure webjob

我在 Azure 门户中的暂存槽中使用自动部署来部署 Webjob,但问题是此 webjob 在部署后直接运行,它可能会导致主槽 webjob 和暂存 webjob 之间出现混淆。

有没有办法在不运行 webjob 的情况下部署它,除非我启动它并交换插槽?

azure-deployment azure-webjobs

5
推荐指数
0
解决办法
406
查看次数

如何在Azure门户中覆盖Azure Sql连接

我尝试connectionstring使用此连接在Azure门户中覆盖:

Server=tcp:server.database.windows.net,1433;Database=mydatabase;User ID=username@server;Password=xxxxxx;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;
Run Code Online (Sandbox Code Playgroud)

它给了我一个错误Keyword not supported: 'server',当我尝试它时:

metadata=res://*/DataAccess.MyDataBase.csdl|res://*/DataAccess.MyDataBase.ssdl|res://*/DataAccess.MyDataBase.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=tcp:server.database.windows.net,1433;initial catalog=MyDataBase;persist security info=True;user id=username@server;password=xxxxxx;MultipleActiveResultSets=True;App=EntityFramework&quot;"
Run Code Online (Sandbox Code Playgroud)

它给"Keyword not supported: 'metadata'.!!

那么connectionstring我应该写什么?

我还尝试了屏幕截图中提供的所有连接字符串类型.在此输入图像描述

entity-framework azure azure-sql-database

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

使用.net sdk检索google驱动器文件列表

我正在尝试从Google云端硬盘中获取文件列表,我正在使用它们提供的示例:

public static List<File> RetrieveAllFiles(DriveService service)
    {
        List<File> result = new List<File>();
        FilesResource.ListRequest request = service.Files.List();

        do
        {
            try
            {
                FileList files = request.Fetch();

                result.AddRange(files.Items);
                request.PageToken = files.NextPageToken;
            }
            catch (Exception e)
            {
                Console.WriteLine("An error occurred: " + e.Message);
                request.PageToken = null;
            }
        } while (!String.IsNullOrEmpty(request.PageToken));
        return result;
    }
Run Code Online (Sandbox Code Playgroud)

它总是返回文件,count = 0而我很确定登录帐户有很多文件!还有其他需要吗?

编辑: 用于身份验证:

  public static IAuthenticator GetCredentials(String authorizationCode, String state)
    {
        String emailAddress = "";
        try
        {
            IAuthorizationState credentials = ExchangeCode(authorizationCode);
            Userinfo userInfo = GetUserInfo(credentials);
            String userId …
Run Code Online (Sandbox Code Playgroud)

.net c# asp.net-mvc-3 google-drive-api

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

Web api HttpContext.Current.Request.UserAgent始终为null

我正在尝试获取一些api用户请求信息,例如他们使用的设备和操作系统,所以我尝试了这样:

private string GetDeviceInfo()
    {
        var userAgent = HttpContext.Current.Request.UserAgent;
        var uaParser = Parser.GetDefault();
        var c = uaParser.Parse(userAgent);
        return c.Device + "|" + c.OS + "|" + c.UserAgent;
    }
Run Code Online (Sandbox Code Playgroud)

HttpContext.Current.Request.UserAgent总是空的!我搜索了一下并尝试了这个链接,你能告诉我有什么问题吗?

c# asp.net asp.net-web-api

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