小编Ema*_*rsa的帖子

Web.Release.Config 身份验证属性

我定义了一个 WebApi,它从浏览器获取凭据,它可以工作。部署后,我必须将服务器上的身份验证从 编辑AnonymounsWindows。我尝试添加<authentication mode="Windows"/>到 Web.Config.Release 但它没有改变...为什么?建议?

c# windows-authentication web-release-config

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

使用 Javascript 将 div 居中

我正在尝试将 div(屏幕中心)居中。这div不是 的直接子代,body所以我不能使用 css。目前,我使用以下 jQuery 代码将它放在我的页面上:

    var dialog = $('#MyDialog');
    dialog.css('left', ($('body').width()/2) - (dialog.width()/2));
    dialog.css('top', ($('body').height()/2) - (dialog.height()/2);
Run Code Online (Sandbox Code Playgroud)

目标是删除 jQuery,我已经写过这个:

var showDialog = function(){

    var body = document.body;
    var html = document.documentElement;

    var bodyHeight = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
    var bodyWidth = Math.max( body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth );

    var dialogWidth = 800;
    var dialogHeight = 560;

    var dialog = document.getElementById('MyDialog');
    dialog.style.left = (bodyWidth/2) - (dialogWidth/2) + 'px';
    dialog.style.top = (bodyHeight/2) - (dialogHeight/2) …
Run Code Online (Sandbox Code Playgroud)

html javascript height width

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

C#等待问题

documentsIDictionary<string, string>参数的位置<filename, fileUrl>

DocumentHandler.Download() 返回一个 Task<Memorystram>

此代码有效:

foreach (var x in documents.Keys)
    {
        var result = await DocumentHandler.Download(new Uri(documents[x]));
        // other code
    }
Run Code Online (Sandbox Code Playgroud)

然而它同步发展.

为了运行它所有async我写了这段代码:

var keys =
documents.Keys.Select(async x =>
    {
        return Tuple.Create(x, await DocumentHandler.Download(new Uri(documents[x])));
    });
await Task.WhenAll(keys);
foreach (var item in keys)
{
    var tpl = item.Result;
    // other code
}
Run Code Online (Sandbox Code Playgroud)

它不起作用,它崩溃而没有在最后一行显示异常var tpl = item.Result;为什么?

c# asynchronous exception async-await

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

git --amend --no-edit拒绝推送

今天我发现--no-edit--amend.但是,它引出了以下问题.这里的步骤:

  • git clone
  • 对代码做了一些更改
  • git add.
  • git commit --amend --no-edit
  • git push origin master

    ! [rejected]        master -> master (non-fast-forward)
    error: failed to push some refs to 'https://me@bitbucket.org/myRepo.git'
    hint: Updates were rejected because the tip of your current branch is behind
    hint: its remote counterpart. Integrate the remote changes (e.g.
    hint: 'git pull ...') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.
    
    Run Code Online (Sandbox Code Playgroud)

为什么?

注意:我是唯一一个处理该回购的人.

git push git-amend

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