我删除了所有证书和私钥,因为我想完全全新安装.现在我无法创建CSR因为我收到错误
输入的用户名或密码不正确
我做过的步骤:
然后出现错误:
输入的用户名或密码不正确
我使用创建了 C# 控制台应用程序OWIN,但在本地主机之外的应用程序可见性方面存在问题。例如,如果我在 URL 中使用 localhost 发出 POST 请求,一切正常,但是当我将邮递员中的 URL 替换为我的全局 IP 地址时,它停止工作。端口已打开,我可以从外部计算机 ping 服务器。早期基于 IIS 的应用程序在此端口上使用此全局 IP 地址和端口运行良好。
_webApp = WebApp.Start<StartOwin>("http://localhost:8511");
Run Code Online (Sandbox Code Playgroud)
上面的行应该包含我的全局IP,或者它可以是具有特定端口的本地主机?
完整代码:
public class Program
{
public static int Main(string[] args)
{
return (int)HostFactory.Run(x =>
{
x.StartAutomatically();
x.Service<OwinService>(s =>
{
s.ConstructUsing(() => new OwinService());
s.WhenStarted(service => service.Start());
s.WhenStopped(service => service.Stop());
});
});
}
}
public class OwinService
{
private IDisposable _webApp;
public void Start()
{
_webApp = WebApp.Start<StartOwin>("http://localhost:8511");
}
public void Stop()
{
_webApp.Dispose();
}
} …Run Code Online (Sandbox Code Playgroud) 我的目标是序列化没有任何属性的属性和具有特定自定义属性的属性。
对于以下课程:
public class Msg
{
public long Id { get; set; }
[CustomAttributeA]
public string Text { get; set; }
[CustomAttributeB]
public string Status { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
当我调用一个方法时Serialize(object, CustomAttributeA),我想要以下输出:
{
"Id" : someId,
"Text" : "some text"
}
Run Code Online (Sandbox Code Playgroud)
当我打电话时Serialize(object, CustomAttributeB),我想拥有以下内容:
{
"Id" : someId,
"Status" : "some status"
}
Run Code Online (Sandbox Code Playgroud)
我读过可以通过创建一个自定义来实现这一点ContractResolver,但是在这种情况下,我必须创建两个单独的合同解析器吗?
我找到了Get/Set缓存项的代码,但我不知道如何调用这个方法,例如.如何通过Func<T> getData这种方法?
public class Cache<T> : MemoryCache where T : class
{
public void Set(string cacheKey, T cacheItem, CacheItemPolicy policy = null)
{
//...
}
public bool TryGet(string cacheKey, out T returnItem)
{
//...
}
public bool TryGetOrSet( string cacheKey, Func<T> getData, out T returnData, CacheItemPolicy policy = null )
{
if( TryGet( cacheKey, out returnData ) )
return true;
lock( WriteLock )
{
if( TryGet( cacheKey, out returnData ) )
return true;
returnData = getData();
Set( cacheKey, …Run Code Online (Sandbox Code Playgroud)