md-frank / file-service Goto Github PK
View Code? Open in Web Editor NEWASP.NET Core based universal file server
License: GNU General Public License v3.0
ASP.NET Core based universal file server
License: GNU General Public License v3.0
分片上传没demo吗
如题,请大佬指教!
如何集群配置呢,是否有demo/doc
sqlserver 的脚本可以提供下不
我的mysql和aspcore程序都是是创建在ubuntu上的,调用删除的http接口的时候aspcore的控制台爆出了下面这个exception:
Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1]
An unhandled exception has occurred while executing the request.
System.InvalidOperationException: The transaction associated with this command is not the connection's active transaction; see mysql-net/MySqlConnector#474
at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQueryAsync(IOBehavior ioBehavior, CancellationToken cancellationToken) in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlCommand.cs:line 233
at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery() in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlCommand.cs:line 60
at Dapper.SqlMapper.ExecuteImpl(IDbConnection cnn, CommandDefinition& command) in C:\projects\dapper\Dapper\SqlMapper.cs:line 552
at Dapper.SqlMapper.Execute(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable1 commandTimeout, Nullable
1 commandType) in C:\projects\dapper\Dapper\SqlMapper.cs:line 443
at Mondol.FileService.Db.Repositories.Impls.FileRepository.<>c__DisplayClass11_0.b__0() in C:\Users\IssaccLee\Documents\GitHub\file-service\src\Mondol.FileService.Db\Repositories\Impls\FileRepository.cs:line 133
at System.Threading.Tasks.Task1.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location where exception was thrown --- at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot) --- End of stack trace from previous location where exception was thrown --- at Mondol.FileService.Controllers.UserFileController.DeleteAsync(String fileToken, String ownerToken) in C:\Users\IssaccLee\Documents\GitHub\file-service\src\Mondol.FileService.Web\Controllers\UserFileController.cs:line 249 at lambda_method(Closure , Object ) at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult() at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at System.Threading.Tasks.ValueTask
1.get_Result()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.Invoke(HttpContext context)
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 27.4832ms 200 application/json; charset=utf-8
你好!
return await Task.FromResult(new Result(ResultErrorCodes.Failure, "暂未实现"));
这个是不是下次升级才会有的?
目前只能用UserFileController中的删除对吗?
部署在linux 上会提示表不存在,脚本创建的表名都是小写的,程序里用File_ , 这样就提示表名不存在
请教一下,配置之后id=2的服务器AllowUpload=false,不接受上传,文件是如何分布到这台服务器的?
谢谢!
Running environment :Centos7.4/ASP.NET CORE 2.2
DockerCommand : docker run --name file_service_api -d -v files_data:/publish/wwwroot/ --restart=always -p 8001:80 file_service_api:$image_version
private void ConvertImage(string srcFilePath, Mime srcMime, string dstFilePath,
ImageModifier dstImgMod)
{
var isSvg = false;
if (srcMime.ContentType == "image/svg+xml")
{
var oldSrcFilePath = srcFilePath;
srcFilePath = Path.Combine(srcFilePath, Guid.NewGuid().ToString("N") + ".svg");
File.Copy(oldSrcFilePath, srcFilePath, true);
isSvg = true;
Log.Info(msg: "进入image/svg+xml", isPushMQ: true);
}
try
{
//命令行参考:http://elf8848.iteye.com/blog/382528
var opt = _option.CurrentValue;
var pArgs = string.Empty;
if (dstImgMod.Size != ImageSize.Raw)
{
var size = dstImgMod.Size;
if (size.Width < 1 && size.Height < 1)
throw new InvalidOperationException("宽与高不能同时小于1");
var widthStr = size.Width > 0 ? size.Width.ToString() : "";
var heightStr = size.Height > 0 ? size.Height.ToString() : "";
var resizeArgs = RexVar.Replace(_option.CurrentValue.ResizeArgs, m =>
{
var varName = m.Groups[1].Value;
switch (varName)
{
case "width":
return widthStr;
case "height":
return heightStr;
default:
return m.Value;
}
});
pArgs += RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? string.Format("-resize '{0}'", resizeArgs) : "-resize \"" + resizeArgs + "\"";
}
pArgs += $" \"{srcFilePath}\" \"{dstFilePath}\"";
var pArgs2 = Path.Combine(srcFilePath, dstFilePath);
var timeoutSec = opt.ConvertTimeout * 1000;
try
{
//pArgs=-resize '64x64>' "/publish/wwwroot/files/2019/09/21/3e49/25_31/raw" "/publish/wwwroot/files/2019/09/21/3e49/25_31/image_64x64_jpg.cvting.jpg"
var exitCode = ProcessUtil.ExecuteCommand(opt.ConverterPath, pArgs, out var stdOut, out var errOut, timeoutSec);
if (exitCode != 0)
{
Log.Info(msg: "convert fail, exitCode=" + exitCode, isPushMQ: true);
throw new InvalidOperationException("convert fail, exitCode=" + exitCode);
}
}
catch (Exception ex)
{
Log.Error(msg: ex.Message, ex: ex, isPushMQ: true);
throw ex;
}
}
catch (Exception ex)
{
try
{
File.Delete(dstFilePath);
}
catch
{
}
throw ex;
}
finally
{
if (isSvg)
try
{
File.Delete(srcFilePath);
}
catch
{
}
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.