小编Det*_*ium的帖子

从后台服务和上传文件验证Sharepoint站点

我正在尝试对Sharepoint进行身份验证,以便我可以将文件上传到特定的Sharepoint站点.

我正在尝试使用X.509证书来检索访问令牌,但我一直在(401):未经授权.

这是我尝试使用证书检索访问令牌的方式:

string authority = SettingsHelper.Authority;
string clientID = SettingsHelper.ClientId;
string serverName = SettingsHelper.SharepointServerName;
//Retreive the certificate path
string certFile = Server.MapPath(SettingsHelper.CertificatePath);
string certPassword = SettingsHelper.CertificatePassword;

AuthenticationResult authenticationResult = null;
AuthenticationContext authenticationContext = new AuthenticationContext(authority);

//Create the certificate file, using the path (certFile), password (certPassword) and the MachineKeySet
X509Certificate2 cert = new X509Certificate2(certFile, certPassword, X509KeyStorageFlags.MachineKeySet);

//Create the ClientAssertionCertificate using the clientID and the actual certificate
ClientAssertionCertificate cac = new ClientAssertionCertificate(clientID, cert);

//Retreive the access token using the serverName and …
Run Code Online (Sandbox Code Playgroud)

c# sharepoint oauth access-token office365

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

Android Throwing OutOfMemoryError"无法分配一个包含44个空闲字节的164字节分配和44B直到OOM"(递归情况)

这个应用程序昨天工作,但今天早上开始工作时,我收到以下错误

Throwing OutOfMemoryError "Failed to allocate a 164 byte allocation with 44 free bytes and 44B until OOM" (recursive case)
Run Code Online (Sandbox Code Playgroud)

我不知道发生了什么,或者为什么它的内存不足.这只是模拟器不能完美运行吗?或者这与我的应用程序有关?

我不知道你需要多少信息.如果您需要更多信息,请告诉我,我会提供.

更新:

我想这与垃圾收集器有关?请参阅下文

Background sticky concurrent mark sweep GC freed 2839(223KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 1603KB/1603KB, paused 31.379ms total 44.794ms
2431-2443/com.example.christian.welldanaapp I/art? Background partial concurrent mark sweep GC freed 529(29KB) AllocSpace objects, 0(0B) LOS objects, 39% free, 1574KB/2MB, paused 52.919ms total 60.062ms
2431-2443/com.example.christian.welldanaapp I/art? Background partial concurrent mark sweep GC freed 5551(277KB) AllocSpace objects, 0(0B) LOS …
Run Code Online (Sandbox Code Playgroud)

android out-of-memory

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

错误NU5012 - nuget pack无法找到路径(/ bin/release/MyProject/bin/release)

我正在尝试通过运行命令更新我的nuget包nuget pack -properties Configuration=Release但这会给我以下错误:

无法找到'bin/Release/{project-name}/bin/Release'.确定该项目已经建成

我不太确定为什么它会进入我的Release文件夹,然后继续转到另一个Release文件夹,因为它不存在?我在这里迷路了,我不知道该怎么做.

nuget nuget-package nuget-cli

8
推荐指数
2
解决办法
2229
查看次数

使用Entity Framework Core不会在MySql实例中插入所有数据

使用MariaDb实例数据库(MySql的fork)并使用Entity Framework Core,给我一个我以前从未体验过的问题,因此这篇帖子因为我不知道发生了什么,并希望你们中的一些人可能会以前经历过这个.

问题

采取以下方案.我们有一个看起来像这样的表

News
-------------------------------------
| Id          | int      | not null |
| Title       | text     | not null |
| Content     | longtext | not null |
| Base64Image | blob     | null     |
-------------------------------------
Run Code Online (Sandbox Code Playgroud)

使用C#,因为我的Web应用程序是在ASP.NET Core MVC中构建的,所以我创建了一个新的News对象实例,就像这样:

public IActionResult New (NewsViewModel model)
{
    using (var db = new DatabaseContext())
    {
        var news = new News()
        {
            Title = model.Title,
            Content = model.Content
        };

        db.News.Add(news);
        db.SaveChanges();
    }
}
Run Code Online (Sandbox Code Playgroud)

正如我以前习惯的常规ASP.NET MVC应用程序一样,我希望它能正常工作.这是抓住了.

在我的数据可视化工具中查看数据(在这种情况下使用HeidiSQL)我可以看到字符串Content被缩短了.我认为这可能只是HeidiSQL中的设置,不显示完整字符串,只显示x …

c# mysql entity-framework-core asp.net-core-mvc

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

机器学习 - 缺少分数列

我正在尝试使用一些随机测试数据的ML.net框架.我的数据存在DepartmentId(1-25)和Body(字符串).我希望我的机器预测应该分配正文的部门(例如在像Zendesk这样的票务系统中).

使用以下代码,我收到一个错误:

ArgumentOutOfRangeException:缺少分数列

我不确定为什么它会说Score列缺失,因为它出现在我的预测课程中.

这是我训练模型以及课程的设置.

主要

var pipeline = new LearningPipeline();
pipeline.Add(new TextLoader(_dataPath).CreateFrom<DepartmentData>(userHeader: true, seperator: ','));
pipeline.Add(new TextFeaturizer("Features", "Body"));
pipeline.Add(new Dictionarizer("Label"));
pipeline.Add(new StochasticDualCoordinateAscentClassifier());
pipeline.Add(new PredictedLabelColumnOriginalValueConverter() { PredictedLabelColumn = "PredictedLabel" });

var model = pipeline.Train<DepartmentData, DepartmentPrediction>();
Run Code Online (Sandbox Code Playgroud)

DepartmentData和DepartmentPrediction

public class DepartmentData
{
    [Column(ordinal: "0", name: "Label")]
    public float Department;
    [Column(ordinal: "1")]
    public string Body;
}

public class DepartmentPrediction
{
    [ColumnName("PredictedLabel")]
    public float Department;

    [ColumnName("Score")]
    public float[] Score;
}
Run Code Online (Sandbox Code Playgroud)

示例数据

Department, Body
1, Hello. 4 weeks ago I requested a replacement …
Run Code Online (Sandbox Code Playgroud)

.net c# machine-learning ml.net

7
推荐指数
0
解决办法
734
查看次数

在 Docker 中运行 Jenkins - 立即退出

我正在尝试使用 docker 运行 Jenkins 服务器。

我已经构建了映像,并尝试使用以下命令运行它:

docker run -p 8080:8080 62a4e44bf4bf
Run Code Online (Sandbox Code Playgroud)

62a4e44bf4bf 是 docker 镜像 ID

每当我运行此命令时,它都会立即关闭。

我试过这个命令:

docker run -i -t -p 8080:8080 62a4e44bf4bf
Run Code Online (Sandbox Code Playgroud)

这将使图像保持运行,但我似乎无法使用以下 ip 从浏览器访问 jenkins:localhost:8080

码头档案:

FROM ubuntu:latest

#Oracle Java7 install
RUN apt-get install software-properties-common -y
RUN apt-get update
RUN add-apt-repository -y ppa:webupd8team/java
RUN apt-get update
RUN echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
RUN apt-get install -y oracle-java7-installer

#Jenkins install
RUN wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
RUN sudo echo "deb …
Run Code Online (Sandbox Code Playgroud)

ubuntu jenkins docker dockerfile

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

EntityFrameworkCore Identity 的继承问题

我最近决定在我使用 ASP.NET Core MVC 开发的网站上实现 ASP.NET Identity 功能。

让我们快速浏览一下主题中的表和类:

public class User : IdentityUser
{
    public string FirstName { get; set; }
    public stirng LastName { get; set; }
    public int CountryId { get; set; }

    public Country Country { get; set; }
}

public class Country 
{
    public int Id { get; set; }
    public string ISO { get; set; }
    public string Name { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

Country班是有点风马牛不相及,但如果你想从参考User类。

通过这个设置,我已经像这样配置了我的数据库上下文:

public class DatabaseContext : …
Run Code Online (Sandbox Code Playgroud)

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

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

UniqueBody不是很独特吗?

我正在尝试用HTML阅读电子邮件的内容.我的问题是,虽然我正在加载,但我的身体并不是很独特EmailMessageSchema.UniqueBody.

这是我期望的解决方案:

var props = new PropertySet(BasePropertySet.IdOnly, 
    EmailMessageSchema.UniqueBody,
    EmailMessageSchema.Subject,
    EmailMessageSchema.To,
    EmailMessageSchema.From
    /*Futher properties if needed*/);

props.RequestedBodyType = BodyType.HTML;

var message = EmailMessage.Bind(subscription.Service, item.ItemId, props);

// Should be unique
var uniqueBody = message.UniqueBody.Text;
Run Code Online (Sandbox Code Playgroud)

在调试和调查我的uniqueBody变量时,我可以清楚地看到这不是唯一的.它需要在当前电子邮件之前收集整个电子邮件正文(因为当前的电子邮件是回复,我不希望得到回复的电子邮件内容).

我不确定我理解EmailMessageSchema.UniqueBody财产的概念,或者我只是做错了什么?

那么,如何在没有父母身体的情况下获得回复电子邮件的独特主体?

c# exchangewebservices ews-managed-api

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

在NETStandard类库中添加引用

我正试图绕过NETStandard类库,找到我正在研究的潜在NuGet包.这是我第一次使用NuGet和NETStandard软件包,所以我在某些方面有点迷失,其中一个是引用系统库.

dynamic类型是其中一部分System.Runtime.CompilerServices.DynamicAttribute,但是不存在对所述DLL的引用.我虽然我会继续添加它,但我似乎无法这样做.我想这不像框架类库那样工作?

如果我Dependencies在解决方案资源管理器中右键单击我的文件夹,然后单击Add Reference...,我似乎无法找到可以使用的任何依赖项.不在Assemblies标签下,没有Assemblies- > FrameworkExtensions.

我只是想了解这实际上是如何工作的,为什么我找不到任何依赖?

c# .net-standard

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

MVC项目在打开Chrome窗格后立即停止调试

我有一个Visual Studio项目,当尝试在谷歌浏览器中运行项目时,它会在谷歌浏览器中打开一个新窗格后立即停止调试.

我怀疑这与IIS Express有关,但我不知道在搜索此问题时从哪里开始.我尝试在线搜索,但没有任何运气.这似乎不是一个常见的问题.

我有一个包含多个项目的解决方案,我的MVC项目依赖于其中一些项目.这一切都很好,我的MVC项目被设置为启动项目.

我很乐意为您提供更多信息,但这就是我的全部.我发现这非常令人不安,因为我无法在编写代码后立即对其进行测试,但我必须手动将其合并到同事解决方案中进行实际测试.

任何指南,提示和技巧,或可能的解决方案非常感谢.

注意:在从同事PC压缩项目,然后复制到我自己并解压缩后,此问题已存在.

额外注意:在VS 2015中打开解决方案时,它要求将项目转换为更新版本.这不会发生在我的同事PC上,我们运行相同版本的VS. 这让我很奇怪,但我没有想到更多.它确实无法转换4个项目,但这些项目都没有在我的MVC项目中作为引用添加.

编辑
以下内容将打印到我的输出窗口:

程序'[13188] iisexpress.exe'已退出,代码为0(0x0).

程序'[13188] iisexpress.exe:Program Trace'已退出,代码为0(0x0).

编辑2
我决定尝试运行这是Internet Explorer而不是谷歌浏览器.现在项目实际上是运行VS,但是我的IIS Express没有启动,因此我无法连接到我的URL(因为除非IIS Express实际运行,否则不存在).

刚试过Microsoft Edge.与Internet Explorer相同的行为.

编辑3
显然我的同事正在使用VS Enterprise 2015,我只使用VS Pro 2015.我们购买的解决方案需要使用VS Enterprise,原因有些奇怪.这就是它在同事环境中完美运行的原因.

c# asp.net asp.net-mvc visual-studio-debugging

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