在我关注如何在Azure门户中使用Redis缓存的Azure 文档时,我注意到了这个注释:
如果您更喜欢使用StackExchange.Redis客户端库的强命名版本,请选择StackExchange.Redis.StrongName; 否则选择StackExchange.Redis.
什么是强名?什么是过程和缺点?如何在我的申请中决定我是否需要它?
我只是想知道为什么我应该使用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) 当我向api控制器添加过滤器属性时,由于使用它不起作用ActionExecutingContext.当我找到我必须使用的解决方案时,HttpActionContext它工作正常.那么它们之间的主要区别是什么?
我不时收到此异常:
“用户”上的“电子邮件”属性无法设置为“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.Coordinator1.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
我在 Azure 门户中的暂存槽中使用自动部署来部署 Webjob,但问题是此 webjob 在部署后直接运行,它可能会导致主槽 webjob 和暂存 webjob 之间出现混淆。
有没有办法在不运行 webjob 的情况下部署它,除非我启动它并交换插槽?
我尝试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="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""
Run Code Online (Sandbox Code Playgroud)
它给"Keyword not supported: 'metadata'.!!
那么connectionstring我应该写什么?
我还尝试了屏幕截图中提供的所有连接字符串类型.
我正在尝试从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) 我正在尝试获取一些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总是空的!我搜索了一下并尝试了这个链接,你能告诉我有什么问题吗?