小编Ehs*_*bar的帖子

错误:任务':app:processDebugResources'的执行失败.> java.io.IOException:无法删除android studio中的文件夹""

我正在尝试使用Android Studio开发Android应用程序,因此我创建了一个Android应用程序,我想发布它.每当我点击"构建项目"来获取apk文件时,我都会收到此错误:

Error:Execution failed for task ':app:processDebugResources'.
> java.io.IOException: Could not delete folder C:\Users\ehsan\AndroidStudioProjects\MyApplication3\app\build\generated\source\r\debug\com\example\ehsan
Run Code Online (Sandbox Code Playgroud)

显示错误消息的屏幕截图

的build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.example.ehsan.myapplication"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.2.0'
}
Run Code Online (Sandbox Code Playgroud)

java android android-studio

66
推荐指数
7
解决办法
13万
查看次数

使用Entity Framework 6从SQL Server保存和检索图像(二进制)

我试图将位图图像保存到数据库

Bitmap map = new Bitmap(pictureBoxMetroMap.Size.Width, pictureBoxMetroMap.Size.Height);
Run Code Online (Sandbox Code Playgroud)

imgcontent在数据库中使用数据类型创建了一个列binary但我的问题是如何将此bitmap(映射)转换为二进制数据?

我如何从数据库中检索数据?

我用谷歌搜索它,我发现这样的东西,但它不起作用:

byte[] arr;
ImageConverter converter = new ImageConverter();
arr = (byte[])converter.ConvertTo(map, typeof(byte[]));
Run Code Online (Sandbox Code Playgroud)

c# binary entity-framework bitmap

37
推荐指数
1
解决办法
9万
查看次数

无法加载文件或程序集'EntityFramework,Version = 6.0.0.0,

我正在与EF合作.我正在尝试执行此行

public ActionResult Edit(string id)
{           
     return View(obj.FindSemesterById(id));
}
Run Code Online (Sandbox Code Playgroud)

我在我的项目上安装了EF Version 5.

但我得到这个错误:

无法加载文件或程序集'EntityFramework,Version = 6.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'或其依赖项之一.定位的程序集的清单定义与程序集引用不匹配.(HRESULT异常:0x80131040)

我的web.config文件:

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <connectionStrings>
    <add name="EducationDBEntities" connectionString="metadata=res://*/EducationModel.csdl|res://*/EducationModel.ssdl|res://*/EducationModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.;initial catalog=EducationDB;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
  <appSettings>
    <add key="webpages:Version" value="2.0.0.0" />
    <add …
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-mvc entity-framework nuget

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

在EF6中将字符串列设置为可为空

我有一个模型,我创建它EF 150:

public partial class Comment
{
    [DisplayName("????? ???")]
    public int Id { get; set; }

    [Required(ErrorMessage = "??? ??? ?? ???? ????")]
    [DisplayName("??? ???")]
    public string CommentText { get; set; }

    [DisplayName("????? ??????? ")]
    public long LikeCount { get; set; }

    [DisplayName("????? ????????")]
    public long DisLikeCount { get; set; }

    [DisplayName("????? ?????? ")]
    public System.DateTime PublishDate { get; set; }

    [DisplayName("????? ????? ")]
    public string Visible { get; set; }

    [DisplayName("??? ?????? ")]
    public Nullable<string> AutherUserName { get; set; …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc entity-framework asp.net-mvc-4

13
推荐指数
1
解决办法
2万
查看次数

提供了无效的请求URI.请求URI必须是绝对URI或必须设置BaseAddress

我试图使用此代码从网页获取内容:

HttpClient http = new HttpClient();
  var response = await http.GetByteArrayAsync("www.nsfund.ir/news?p_p_id=56_INSTANCE_tVzMoLp4zfGh&_56_INSTANCE_tVzMoLp4zfGh_mode=news&_56_INSTANCE_tVzMoLp4zfGh_newsId=3135919&p_p_state=maximized");
   String source = Encoding.GetEncoding("utf-8").GetString(response, 0, response.Length - 1);
   source = WebUtility.HtmlDecode(source);
   HtmlDocument resultat = new HtmlDocument();
   resultat.LoadHtml(source);
Run Code Online (Sandbox Code Playgroud)

但我得到这个错误:

提供了无效的请求URI.请求URI必须是绝对URI或必须设置BaseAddress.

c# http httpclient

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

'某些服务无法构建(验证服务描述符时出错'ServiceType:IHostedService

我正在使用 .NET 5,我想使用IHostedService类运行后台任务,如您所见:

public class PasargadJobs : IHostedService, IDisposable
{
    private Timer _timer = null!;
    readonly  ITerminalService _terminalService;
    readonly  IMessageService _messageService;
    readonly IMerchantService _merchantService;
    
    public PasargadJobs(
        IMerchantService merchantService,
        ITerminalService terminalService,
        IMessageService messageService)
    {
        _messageService = messageService;
        _terminalService = terminalService;
        _merchantService = merchantService;
    }
    
    //other parts of code are removed for short code
}
Run Code Online (Sandbox Code Playgroud)

所以我必须将它注入到服务集合中,如您所见:

services.AddHostedService<PasargadJobs>();
Run Code Online (Sandbox Code Playgroud)

但添加此后我收到此错误:

System.AggregateException:“无法构造某些服务(验证服务描述符时出错”ServiceType:Microsoft.Extensions.Hosting.IHostedService Lifetime:Singleton ImplementType:MIMS.Portal.ScheduleJobs.PasargadJobs”:无法使用作用域服务“Microsoft” .EntityFrameworkCore.DbContextOptions`1[MIMS.Portal.Infrustruct.Repositories.AppDbContext]'来自单例'Microsoft.Extensions.Hosting.IHostedService'。)'

这是我的startup.cs

services.AddExpressiveAnnotations();

//--- DB Context ---//
services.AddTransient<AppDbContext, AppDbContext>();
//--- Repositories ---//
services.AddTransient(typeof(IGenericRepository<>), typeof(GenericRepository<>));
services.AddTransient<IMerchantRepository, MerchantRepository>();
services.AddTransient<IBankAccountRepository, BankAccountRepository>();
services.AddTransient<IBankRepository, …
Run Code Online (Sandbox Code Playgroud)

dependency-injection background-task asp.net-core asp.net-core-hosted-services servicecollection

13
推荐指数
1
解决办法
5万
查看次数

CustomAuthorizationPolicy.Evaluate()方法永远不会在wcf webhttpbinding中触发

我可以看到我创建了一个wcf服务:

[OperationContract]
[PrincipalPermission(SecurityAction.Demand, Role = "Admin")]
[WebInvoke(Method = "GET", UriTemplate = "/Data/{data}")]

string GetData(string data);
Run Code Online (Sandbox Code Playgroud)

所以我创建了一个自定义授权,你可以看到:

public class AuthorizationPolicy : IAuthorizationPolicy
{
    string id = Guid.NewGuid().ToString();

    public string Id
    {
        get { return this.id; }
    }

    public System.IdentityModel.Claims.ClaimSet Issuer
    {
        get { return System.IdentityModel.Claims.ClaimSet.System; }
    }

    // this method gets called after the authentication stage
    public bool Evaluate(EvaluationContext evaluationContext, ref object state)
    {
        // get the authenticated client identity
        IIdentity client = HttpContext.Current.User.Identity;

        // set the custom principal
        evaluationContext.Properties["Principal"] = …
Run Code Online (Sandbox Code Playgroud)

c# wcf authorization restful-architecture

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

在MVC中使用webbackgrounder nuget可以长时间运行后台任务

我需要在后台实现一项任务,那么我的任务是什么?我有一个存储每个客户租金金额的表,所以我需要在特定的datetimeackf 之后计算每个月的租金价格,所以我用谷歌搜索它,我发现了一段代码(它是nuget叫webbackgrounder)我把它添加到我的解决方案,它给了我这部分代码来处理我的任务:

using System;
using System.Threading;
using System.Threading.Tasks;

    namespace WebBackgrounder.DemoWeb
    {
        public class SampleJob : Job
        {
            public SampleJob(TimeSpan interval, TimeSpan timeout)
                : base("Sample Job", interval, timeout)
            {
            }

            public override Task Execute()
            {
                return new Task(() => Thread.Sleep(3000));
            }
        }
    }
Run Code Online (Sandbox Code Playgroud)

我想知道如何编写我的任务?

更多细节:这里

我发现这篇文章,但实际上我不知道我可以长时间使用这种方法吗?最好的祝福 .

任何想法将不胜感激.

c# multithreading scheduled-tasks nuget asp.net-mvc-4

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

docker :manifest for microsoft/windowsservercore:latest not found

我想在我的 Docker 容器中运行 IIS

在此处输入图片说明

但是当我写这个命令时:

docker pull microsoft/windowsservercore
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

使用默认标记:来自守护进程的最新错误响应:microsoft/windowsservercore 清单:未找到最新

windows iis docker docker-for-windows

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

gdip image直接在我的本地驱动器中保存intptr

我有这段代码从扫描仪获取图像文件并将其保存在本地磁盘上:

                            IntPtr img = (IntPtr)pics[i];
                            SetStyle(ControlStyles.DoubleBuffer, false);
                            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
                            SetStyle(ControlStyles.Opaque, true);
                            SetStyle(ControlStyles.ResizeRedraw, true);
                            SetStyle(ControlStyles.UserPaint, true);
                            bmprect = new Rectangle(0, 0, 0, 0);
                            bmpptr = GlobalLock(img);
                            pixptr = GetPixelInfo(bmpptr);
                            Gdip.SaveDIBAs(@"C:\", bmpptr, pixptr);
Run Code Online (Sandbox Code Playgroud)

问题出在这里Gdip.SaveDIBAs(@"C:\", bmpptr, pixptr);.保存对话框. 在此输入图像描述

我想丢弃此对话框并将文件直接保存在我的驱动器中.

**Updated:**



  public static bool SaveDIBAs(string picname, IntPtr bminfo, IntPtr pixdat)
        {
            SaveFileDialog sd = new SaveFileDialog();

            sd.FileName = picname;
            sd.Title = "Save bitmap as...";
            sd.Filter =
                "Bitmap file (*.bmp)|*.bmp|TIFF file (*.tif)|*.tif|JPEG file (*.jpg)|*.jpg|PNG file (*.png)|*.png|GIF file (*.gif)|*.gif|All files (*.*)|*.*";
            sd.FilterIndex = 1;

            return …
Run Code Online (Sandbox Code Playgroud)

c# image scanning intptr save-dialog

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