我正在尝试在 .net core 中使用 SOAP 服务
我想将安全模式的基本 httpbinding 设置为 TransportWithMessageCredential
和 clientcredentialType 作为证书
但我收到一个错误
在此上下文中,绑定安全属性“securityMode”不支持值“TransportWithMessageCredential”。
代码看起来像这样
var client = new SoapCustomClient();
var binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential);
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
client.ClientCredentials.ClientCertificate.Certificate = certCollection[0];
Run Code Online (Sandbox Code Playgroud)
我在这里犯了一些严重的错误吗?任何解决方案?
[我能够在 .net 框架中实现这一点,但不能在 .net 核心中实现]
我的MVC4应用程序允许使用LinkedIn帐户登录.我想从登录用户的linkedIn中提取所有可用的详细信息.目前我做了以下工作.
在My AuthConfig.cs中,
Dictionary<string, object> linkedInExtraData = new Dictionary<string, object>();
linkedInExtraData.Add("Icon", "../Images/linkedIn.png");
OAuthWebSecurity.RegisterClient(
client: new App_Start.LinkedInCustomClient("xxxxxxxxxxxx", "yyyyyyyyyyyyyyy"),
displayName: "LinkedIn",
extraData: linkedInExtraData);
Run Code Online (Sandbox Code Playgroud)
在linkedIncustomClient.cs中,来自LinkedIn Developer Kit
public class LinkedInCustomClient : OAuthClient
{
private static XDocument LoadXDocumentFromStream(Stream stream)
{
var settings = new XmlReaderSettings
{
MaxCharactersInDocument = 65536L
};
return XDocument.Load(XmlReader.Create(stream, settings));
}
/// Describes the OAuth service provider endpoints for LinkedIn.
private static readonly ServiceProviderDescription LinkedInServiceDescription =
new ServiceProviderDescription
{
AccessTokenEndpoint =
new MessageReceivingEndpoint("https://api.linkedin.com/uas/oauth/accessToken",
HttpDeliveryMethods.PostRequest),
RequestTokenEndpoint =
new MessageReceivingEndpoint("https://api.linkedin.com/uas/oauth/requestToken?scope=r_fullprofile",
HttpDeliveryMethods.PostRequest),
UserAuthorizationEndpoint = …Run Code Online (Sandbox Code Playgroud) 我需要通过post url("www.example.com/exampleblog")而不使用fql来获取facebook,分享和评论计数(因为v2.1不支持fql).
我不想要下面的一个
https://graph.facebook.com/fql?q=SELECT url,
share_count, like_count, comment_count,
total_count,commentsbox_count, comments_fbid,
click_count FROM link_stat WHERE url='http://example.example.com/'
Run Code Online (Sandbox Code Playgroud)
任何人都可以建议替代上述,支持api v2.1?
facebook social-media facebook-fql facebook-graph-api facebook-graph-api-v2.0
GET :http://www.Example.com/Api/1/0/Book/Company/0
[Route("{UserId}/{Category}/books/{BookType}/{Page}")]
[HttpGet]
[RequestAuthorization]
public Response Get(int UserId,string Category, string BookType,int Page )
{
var books= this.contentService.GetUserItems(UserId,Category, BookType, Page)
return new Response() { Status = ApiStatusCode.Ok, Books = books};
}
Run Code Online (Sandbox Code Playgroud)
上面的代码对我很有用.
我的问题是可以在GET请求中绑定请求模型吗?
例如,我有一个这样的请求模型
public class BookbRequestModel
{
public int UserId { get; set; }
public int Category { get; set; }
public int Page { get; set; }
public string BookType { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我想要这样的获取请求
GET :http://www.Example.com/Api/1/0/Book/Company/0
to bind the data to my request model
[Route("{UserId}/{Category}/books/{BookType}/{Page}")]
[HttpGet] …Run Code Online (Sandbox Code Playgroud) 我有一份销售人员报告,我想要的是每天以csv格式安排此报告,以便用户使用此附件获取邮件.
c# ×2
.net-core ×1
asp.net-mvc ×1
facebook ×1
facebook-fql ×1
get ×1
linkedin ×1
oauth ×1
salesforce ×1
soap ×1
social-media ×1
wcf ×1