小编JGH*_*JGH的帖子

kestrel-hellomvc.service:步骤USER产生失败/ usr/bin/dotnet:没有这样的过程

我在nginx上发布asp.net核心项目时遵循教程https://docs.microsoft.com/en-us/aspnet/core/publishing/linuxproduction

以前的步骤似乎都成功了,

但同时

systemctl start kestrel-hellomvc.service
systemctl status kestrel-hellomvc.service
Run Code Online (Sandbox Code Playgroud)

我有

kestrel-hellomvc.service - Example .NET Web API Application running on Ubuntu

Loaded: loaded (/etc/systemd/system/kestrel-hellomvc.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2017-04-24 03:12:42 UTC; 8s ago
Process: 4285 ExecStart=/usr/bin/dotnet /home/84999/Demo4/Demo4.dll (code=exited, status=217/USER)
Main PID: 4285 (code=exited, status=217/USER)

Apr 24 03:12:42 instance-5 systemd[1]: Started Example .NET Web API Application running on Ubuntu.
Apr 24 03:12:42 instance-5 systemd[4285]: kestrel-hellomvc.service: Failed at step USER spawning /usr/bin/dotnet: No such process
Apr …
Run Code Online (Sandbox Code Playgroud)

deployment systemd asp.net-core

6
推荐指数
2
解决办法
7402
查看次数

记录“新”没有字段“治愈”postgreSQL

所以这就是事情,我有两个表:apointments(带有单个 p)和医疗文件夹,我得到了这个

错误:记录“new”没有字段“cure”上下文:SQL语句“插入到medical_folder(id,“patient_AMKA”,cure,drug_id)值(new.id,new。“patient_AMKA”,new.cure,new.drug_id )" PL/pgSQL 函数 new_medical() 第 3 行在 SQL 语句

create trigger example_trigger after insert on apointments 
for each row execute procedure new_medical();

create or replace function new_medical()
returns trigger as $$
begin 
if apointments.diagnosis is not null then
insert into medical_folder(id,"patient_AMKA",cure,drug_id)
values(new.id,new."patient_AMKA",new.cure,new.drug_id);
return new;
end if;
end;
$$ language plpgsql;


insert into apointments(id,time,"patient_AMKA","doctor_AMKA",diagnosis)
values('30000','2017-05-24 0 
07:42:15','4017954515276','6304745877947815701','M3504');
Run Code Online (Sandbox Code Playgroud)

我已经检查了多次,我所有的表和列都存在请帮忙!谢谢!

表结构是:

create table medical_folder (
  id      bigInt,
  patient bigInt,
  cure    text,
  drug_id bigInt);

create table apointments (
  id      bigint,
  time …
Run Code Online (Sandbox Code Playgroud)

postgresql

6
推荐指数
1
解决办法
6459
查看次数

AddDbContext在.NET Core中的IServiceCollection中不可用

我在Visual Studio 2017中有.NET Core 2项目.我正在尝试添加(Postgresql)数据库连接.这是一个代码:

public void ConfigureServices(IServiceCollection services)
{
    services.AddDbContext(options =>
        options.UseNpgsql(Configuration.GetConnectionString("DefaultConnection")));

    // Add framework services.
    services.AddMvc();
}
Run Code Online (Sandbox Code Playgroud)

但编译器抱怨这条消息:

IServiceCollection不包含'AddDbContext'的定义,并且没有可以找到接受类型'IServiceCollection'的第一个参数的扩展方法'AddDbContext'(你是否缺少using指令或汇编引用?)

我安装了NuGet包Npgsql.我也尝试安装NuGet包EntityFramework,但我收到错误:

包恢复失败.回滚"MyProject"的包更改.

这是我问题的根源吗?我应该安装一些其他库吗?

在这个问题上使用了 AddEntityFramework()和AddEntityFrameworkNpgsql()程序,但是我的项目中的编译器也无法识别这两个程序.

.net c# postgresql .net-core visual-studio-2017

6
推荐指数
2
解决办法
3349
查看次数

Postgres 9.6升级后极慢的查询执行速度

Postgres从9.5升级到9.6与查询Osmosis(用于处理OpenStreetMap数据的命令行Java应用程序)相关的处理时间非常慢.特别是将本地osm数据库与主osm repo同步(Postgis 2.3 from 2.2).同步过去每天都发生,平均花费大约500秒.升级后,48小时后仍然没有结束.我注意到与之前相比,对象处理时间非常慢(低于零)(下面的日志记录).我很确定问题出在Postgres更新上.无法弄清楚要解决的问题.pg_stat_activity提供以下查询(当前):

UPDATE ways w 
SET linestring = ( 
    SELECT ST_MakeLine(c.geom) AS way_line 
    FROM ( 
        SELECT n.geom AS geom 
        FROM nodes n 
        INNER JOIN way_nodes wn ON n.id = wn.node_id 
        WHERE (wn.way_id = w.id) 
        ORDER BY wn.sequence_id ) c ) 
WHERE w.id IN ( 
    SELECT w.id 
    FROM ways w 
    INNER JOIN way_nodes wn ON w.id = wn.way_id 
    WHERE wn.node_id = $1 
    GROUP BY w.id ) 
Run Code Online (Sandbox Code Playgroud)

更新后的日志记录:

Oct 31, 2017 12:23:59 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version 0.45 …
Run Code Online (Sandbox Code Playgroud)

postgresql postgis openstreetmap osmosis

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

OpenLayers 5 v5.2.0 将圆绘制为多边形

我正在尝试升级到 OpenLayers v5.2.0,但我看不到有一条清晰的路径可以将圆绘制为多边形(我需要它,以便我可以将其存储在我们的数据库中)

这就是我正在做的...

if (webMapValues.activeDrawControl == "Circle") {
    var wgs84Sphere = new ol.Sphere(6378138);
    webMapValues.drawObj = new ol.interaction.Draw({
        features: webMapValues.features,
        type: /** @type {ol.geom.GeometryType} */ (webMapValues.drawType),
        geometryFunction: function (coordinates, geometry) {
            if (!geometry) {
                geometry = new ol.geom.Polygon(null);
            }
            var center = coordinates[0];
            var last = coordinates[1];
            var dx = center[0] - last[0];
            var dy = center[1] - last[1];
            var radius = Math.sqrt(dx * dx + dy * dy);
            var circle = ol.geom.Polygon.circular(wgs84Sphere, ol.proj.toLonLat(center), radius);
            circle.transform('EPSG:4326', 'EPSG:3857');
            geometry.setCoordinates(circle.getCoordinates());
            return geometry; …
Run Code Online (Sandbox Code Playgroud)

openlayers openlayers-5

5
推荐指数
0
解决办法
1663
查看次数

postgresql重建索引和重建索引之间有什么区别,哪个更好?

我有一张表,索引大小太大(约2G)。当我将数据库还原到VM时,大小只有200M,因此我需要重建/重新创建索引,并且可能会在线进行。

重建(重建索引)和重建索引之间有什么区别,当我在线进行索引时哪个更好?特别是,哪个选项允许在操作期间查询数据库?

postgresql postgresql-9.3

4
推荐指数
1
解决办法
1953
查看次数

使用 OpenLayers 和 Angular 6 向地图添加标记

我在 angular 6 中为我的项目调查了 OpenLayers 4.3.4。我实现了它来显示地图:-) 但我不能让它显示标记。我在这个问题和答案上看了很多(如何通过方法添加标记,openlayers 4,angular 4),但我不能让它工作:-|

我收到此错误:

core.js:1448 错误类型错误:layer.getLayerStatesArray 不是函数

首先十分感谢

 import { Component, OnInit } from '@angular/core';
 import OlInteraction from 'ol/interaction';
 import OlTileLayer from 'ol/layer/tile';
 import OlMap from 'ol/map';
 import OlOverlay from 'ol/overlay';
 import OlProj from 'ol/proj';
 import OlXYZ from 'ol/source/xyz';
 import OlView from 'ol/view';
 import * as ol from 'openlayers';



export class OpenStreetMapComponent implements OnInit {

map: OlMap;
source: OlXYZ;
layer: OlTileLayer;
view: OlView;
olOverlay: OlOverlay;
olFeature: OlFeature;
markerSource: ol.source.Vector;

constructor() {
} …
Run Code Online (Sandbox Code Playgroud)

maps openlayers angular

3
推荐指数
1
解决办法
9016
查看次数

如何将参数传递给 postgre 函数并使用 ExecuteReader 获取数据?

我正在尝试在 C# 应用程序中使用 ExecuteReader 从表中检索所有列。Db 是 postgre。为了测试,我按照教程创建了一个控制台应用程序,该教程确实展示了如何使用函数进行查询,但不使用传递参数。控制台应用程序函数用于测试

    static void Main(string[] args)
    {
        // Connect to a PostgreSQL database
        NpgsqlConnection conn = new NpgsqlConnection("Server=localhost;User Id=postgres; " +
            "Password=pes;Database=pmc;");
        conn.Open();

        // Define a query
        NpgsqlCommand command = new NpgsqlCommand("SELECT * from audit.exception_gl_accounts()", conn);

        // Execute the query and obtain a result set
        NpgsqlDataReader dr = command.ExecuteReader();

        // Output rows
        while (dr.Read())
            Console.Write("{0}\t{1} \n", dr[0], dr[1]);

        conn.Close();
    }
}
Run Code Online (Sandbox Code Playgroud)

在 NpgsqlCommand 中,我将不带参数的查询发送到函数audit.exception_gl_accounts,它运行良好。现在我如何将参数传递给这样的函数

“从 sms.get_accounts_info(@AccountNumber) 选择*;

我正在尝试使用此函数检索所有 5 列并获取这些对象

    public static string GetAccountInfo(string accountNumber) …
Run Code Online (Sandbox Code Playgroud)

c# postgresql npgsql

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

Postgis ST_Intersects 两个表之间真的(真的真的)慢

我正在尝试在两个表之间进行空间连接:

  1. 表 1:397265 个特征(带有 geom 字段的要点索引)
  2. 表 2:73 个特征(在 geom 字段上有要点索引)

表 1 和表 2 具有相同的 SRID。

我做了很多测试,这些表之间的空间连接需要几天时间(5 天后我终止了查询)。我试图理解为什么解释分析这么慢:

EXPLAIN ANALYZE 
SELECT 
    table1.id,  table2.id
FROM table1
INNER JOIN table2 ON ST_Intersects(
        ST_Buffer(table1.geom,0),
        ST_Buffer(table2.geom,0)
)
Run Code Online (Sandbox Code Playgroud)

但是现在我仍在等待结果,因为 EXPLAIN ANALYZE 确实执行了查询。

如果我只做一个解释,结果是:

"Gather  (cost=1000.00..3820127.08 rows=9667 width=40)"
"  Workers Planned: 3"
"  ->  Nested Loop  (cost=0.00..3818111.26 rows=3118 width=40)"
"        Join Filter: ((st_buffer(table2.geom, '0'::double precision) && st_buffer(table1.geom, '0'::double precision)) AND _st_intersects(st_buffer(table2.geom, '0'::double precision), st_buffer(table1.geom, '0'::double precision)))"
"        ->  Parallel Seq Scan on table1  (cost=0.00..21964.50 rows=128150 …
Run Code Online (Sandbox Code Playgroud)

postgis

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

postgres>在另一个架构中创建触发器

我正在使用postgres 9.5,并且以postgres用户身份登录数据库xyz。现在,我需要在架构abc中创建触发器。触发器将是在表def中的表Tab1上的删除或更新之前。

psql -d xyz

xyz=#create trigger abc.trg_name before delete or update on col1 ON DEF.Tab1
FOR EACH ROW EXECUTE PROCEDURE abc.proc1();
Run Code Online (Sandbox Code Playgroud)

但是,我无法这样做。我在“”附近收到语法错误。

当我尝试使用双引号时,将创建TRIGGER,但未在abc模式中创建-在DEF模式(基础表的模式)中:

psql -d xyz

xyz=#create trigger abc.trg_name before delete or update on col1 ON DEF.Tab1
FOR EACH ROW EXECUTE PROCEDURE abc.proc1();
Run Code Online (Sandbox Code Playgroud)

Postgres中有一种方法可以在与其底层引用表不同的架构中创建触发器?

我尝试将SEARCH_PATH设置为abc,但仍在DEF模式下创建它。感谢您提前答复!

postgresql

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

为什么缩放级别返回小数?

我在我的项目中使用 openlayers 6。地图上的图层根据缩放级别隐藏/显示。

这是地图和视图定义:

view = new View({
    center: mapCenter,
    projection: israeliTM.getCode(),
    zoom: 0,
    resolutions: resolutions // resolutions array 
});

map = new Map({
    layers: layers,
    target: 'map',
    view: view
});
Run Code Online (Sandbox Code Playgroud)

当缩放更改时会触发此行:

var curRes = map.getView().getResolution()[map.getView().getZoom()];
Run Code Online (Sandbox Code Playgroud)

正如您在定义为数组的视图定义分辨率中看到的,当缩放更改时,我希望从这个map.getView().getZoom()整数中获取显示分辨率数组中的索引并返回当前分辨率。一般来说,它按预期工作,但有时 map.getView().getZoom()会返回十进制数,例如 3.56989。

知道为什么map.getView().getZoom()返回一些小数时间吗?

openlayers

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

PostGIS ST_Distance_Spheroid 或Haversine

ST_Distance_Spheroid在 PostgreSQL(使用 Postgis)中使用来计算沃金和爱丁堡之间的距离,如下所示:

CREATE TABLE pointsTable (
    id serial NOT NULL,
    name varchar(255) NOT NULL,
    location Point NOT NULL,
    PRIMARY KEY (id)
);

INSERT INTO pointsTable (name, location) VALUES 
( 'Woking', '(51.3168, -0.56)' ),
( 'Edinburgh', '(55.9533, -3.1883)' );

SELECT ST_Distance_Spheroid(geometry(a.location), geometry(b.location), 'SPHEROID["WGS 84",6378137,298.257223563]')
FROM pointsTable a, pointsTable b
WHERE a.id=1 AND b.id=2;
Run Code Online (Sandbox Code Playgroud)

我得到了 592 公里(592,053.100454442 米)的结果。

不幸的是,当我使用网络上的各种来源进行相同的计算时,我始终在 543 公里附近,相差 8.2%。

幸运的是,第三个消息来源澄清说他们使用的是半正弦公式。我不确定其他两个来源。

我在查询中做错了什么还是因为使用的公式不同?如果是这样,哪个计算最接近乌鸦可以飞行的最短距离,保持恒定的高度?

postgis haversine

0
推荐指数
1
解决办法
1133
查看次数

升级 .NET Core 时 Postgres 功能不起作用

当我们将 .net core 和其他软件包升级到最新版本时,Postgres 功能无法正常工作。早些时候,相同的代码运行得很好。

我们使用函数而不是存储过程。

DbTransaction transaction = connection.BeginTransaction(IsolationLevel.ReadCommitted);

try
{
        using (DbCommand command = connection.CreateCommand())
        {
            command.Transaction = transaction;
            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = Constants.StoredProcedure.SPNAME;
            command.Parameters.Add(new NpgsqlParameter("Param1", NpgsqlTypes.NpgsqlDbType.Integer)
            { Value = val1 });
            command.Parameters.Add(new NpgsqlParameter("Param2", NpgsqlTypes.NpgsqlDbType.Varchar)
            { Value = val2 });
            command.Parameters.Add(new NpgsqlParameter("Param3", NpgsqlTypes.NpgsqlDbType.Varchar)
            { Value = val3 });
            var res = command.ExecuteScalar();
            transaction.Commit();
}}
Run Code Online (Sandbox Code Playgroud)

错误 - Npgsql.PostgresException:'42809:public.NotableEventUserModeratorJoinOrder(Param1 => 整数,Param2 => 字符变化,Param3 => 字符变化)不是过程

我们注释了行command.CommandType = CommandType.StoredProcedure;,然后收到错误 - PostgreSQL,Npgsql 返回 42601:语法错误

postgresql npgsql

0
推荐指数
1
解决办法
1015
查看次数