小编Anj*_*ali的帖子

在 Postman 中连接 ECONNREFUSED

我正在尝试通过邮递员测试我的 REST API,但出现以下错误:

在此处输入图片说明

这是我编写的第一个 REST API,我对邮递员很陌生,所以不确定我做错了什么。下面是我试图用这个 URL 调用邮递员的代码。我在 URL 中传递两个日期参数

https://localhost:44360/api/RecLoadPrime/insertRecLoadData/?RecStartDate=01/01/2020&RecEndDate=01/02/2020
Run Code Online (Sandbox Code Playgroud)

下面是代码:

using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading.Tasks;
    using Microsoft.AspNetCore.Http;
    using Microsoft.AspNetCore.Mvc;
    using RecLoad.DAL;

    namespace RecLoad.Controllers
    {
        [Route("api/[controller]")]
        [ApiController]
        public class RecLoadPrimeController : ControllerBase
        {

            [Route("RecLoadPrime/insertRecLoadData/{RecStartDate}/{RecEndDate}")]
            [HttpPost]
            public void insertRecLoadData(string RecStartDate, string RecEndDate)
            {
                RecLoadDataProvider dataProvider = new RecLoadDataProvider();
                dataProvider.InsertData(RecStartDate, RecEndDate);
            }
        }
    }
Run Code Online (Sandbox Code Playgroud)

邮递员的其他选项卡,授权,标题,正文,预请求脚本,测试和设置下没有任何内容。以下是邮递员的屏幕截图:

在此处输入图片说明

当我尝试通过将此 URL 放入浏览器来直接运行 API 时,我收到错误消息:

This localhost page can’t be foundNo webpage was found for the web address: https://localhost:44360/api/RecLoadPrime/insertRecLoadData/?RecStartDate=01/01/2020&RecEndDate=01/02/2020
Run Code Online (Sandbox Code Playgroud)

任何帮助将不胜感激。

c# api rest postman

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

出现错误在 angular 8 中找不到模块“@angular/compiler-cli/ngcc”

当我尝试从终端窗口运行 ng serve 时出现此错误。

An unhandled exception occurred: Cannot find module '@angular/compiler-cli/ngcc'
Run Code Online (Sandbox Code Playgroud)

下面是我的 package.json 文件

{
  "name": "ProjectDetails",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --extract-css",
    "build": "ng build --extract-css",
    "build:ssr": "npm run build -- --app=ssr --output-hashing=media",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^5.2.0",
    "@angular/common": "^5.2.0",
    "@angular/compiler": "^5.2.0",
    "@angular/core": "^5.2.0",
    "@angular/forms": "^5.2.0",
    "@angular/platform-browser": "^5.2.0",
    "@angular/platform-browser-dynamic": "^5.2.0",
    "@angular/platform-server": "^5.2.0",
    "@angular/router": "^5.2.0",
    "@nguniversal/module-map-ngfactory-loader": "^5.0.0-beta.5",
    "aspnet-prerendering": "^3.0.1",
    "bootstrap": "^3.4.1",
    "core-js": …
Run Code Online (Sandbox Code Playgroud)

angular angular8

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

错误 TS2440 (TS) 导入声明与“PluginConfig”的本地声明冲突

我正在尝试在 Visual Studio 2017 中运行我的应用程序,但不断收到错误消息:

 "Error TS2440  (TS) Import declaration conflicts with local declaration of 'PluginConfig'"
Run Code Online (Sandbox Code Playgroud)

我尝试降级我的打字稿,但错误并没有消失。下面是我的 package.json 文件:

{
  "name": "frontend",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build --prod",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^5.2.4",
    "@angular/cdk": "^5.2.1",
    "@angular/common": "^5.2.0",
    "@angular/compiler": "^5.2.0",
    "@angular/core": "^5.2.0",
    "@angular/flex-layout": "^5.0.0-beta.14",
    "@angular/forms": "^5.2.0",
    "@angular/http": "^5.2.0",
    "@angular/material": "^5.2.1",
    "@angular/platform-browser": "^5.2.0",
    "@angular/platform-browser-dynamic": "^5.2.0",
    "@angular/router": "^5.2.0",
    "ajv": "^6.0.0",
    "angular2-text-mask": "^9.0.0",
    "angular5-time-picker": …
Run Code Online (Sandbox Code Playgroud)

visual-studio angular

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

SqlParameterCollection 仅接受非 null Parameter 类型对象

我正在尝试在 Entity Framework Core 中使用存储过程。执行存储过程时,我传递两个输入参数和一个输出参数。我不断收到此错误:

SqlParameterCollection 仅接受非空 SqlParameter 类型对象,而不接受 SqlParameter 对象。

这是我的代码:

public string InsertCardsData(DateTime RecordingStartDate, DateTime RecordingEndDate)
{
        try
        {
            // DateTime DRecEndDate = Convert.ToDateTime(RecordingEndDate);
            DateTime DRecEndDate = RecordingEndDate.AddDays(1);

            var RecordStartDate = new SqlParameter
            {
                ParameterName = "RecordingStartDate",
                Value = RecordingStartDate,
                Direction = ParameterDirection.Input
            };

            var RecordEndDate = new SqlParameter
            {
                ParameterName = "RecordingEndDate",
                Value = DRecEndDate,
                Direction = ParameterDirection.Input
            };

            var RecordCount = new SqlParameter
            {
                ParameterName = "RecLoadCount",
                Direction = ParameterDirection.Output
            };

            var SQL = "Exec Recload_InsertPrimeExtract …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework entity-framework-core

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

使用 router.navigate 进行角度路由

我正在尝试从当前组件导航到另一个组件,如下所示:

this.router.navigate(['/relationshipInfo']);
Run Code Online (Sandbox Code Playgroud)

上面的语句没有路由到不同的组件,下面是我在 app-routing.module.ts 中的代码:

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import {PersonalInfoComponent} from './PersonalInfo/PersonalInfo.component';
import {RequiredInfoComponent} from './RequiredInfo/RequiredInfo.component';
import {RelationshipInfoComponent} from './relationshipInfo/relationshipInfo.component'

const routes: Routes = [

  {path: 'PersonalInfo', component: PersonalInfoComponent},
  {
    path: '',
    children: [
      {path: 'RequiredInfo', component: RequiredInfoComponent},
      {path: 'RelationshipInfo', component: RelationshipInfoComponent},

  ]

  },

  {path: '**', redirectTo: 'PersonalInfo', pathMatch: 'full'},

];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
Run Code Online (Sandbox Code Playgroud)

下面是我的 app.module.ts:

import { BrowserModule } from '@angular/platform-browser'; …
Run Code Online (Sandbox Code Playgroud)

typescript angular

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

如何将 JSON 文件中的图像放入 React Native Js 页面

我需要将 JSON 文件中的图像放入我的 React Native 页面。下面是我的代码:

 <View style={{ flexDirection: 'row', alignItems:'center' }}>
                       <Image source={{item.image}} style = {styles.imageView}/>
                 <View style={{  flex: 1, alignItems: "center"}}>
                        <Text  style={styles.Address1}>{item.addr} </Text>
                </View>
            </View>
Run Code Online (Sandbox Code Playgroud)

我可以从 JSOn 文件中读取其他内容,例如 item.addr 来自 json 文件,但不确定如何读取图像。我尝试像这样编写 json 文件:

 {

        "addr": "124 test drive, Ring road",
        "phone": "(951)-955-6200",
        "LatL":"33.977880",
        "Long2":"-117.373423",
        "cLat": "33.931989",
        "cLong": "-117.409222",
        "Online": "https://www.test.org",
         "image" : "require(\"CAC.png\")"
     }
Run Code Online (Sandbox Code Playgroud)

我还尝试在 JSON 文件中编写如下所示的图像

"image" : "require('../images/CAC.png')"
Run Code Online (Sandbox Code Playgroud)

看起来,它正在读取空白图像:下面是屏幕截图:

在此输入图像描述

下面的代码可以工作,但在这种情况下,我正在编写一个常量图像,而不是从 json 文件中读取。

 <Image source={require('../images/CAC.png')} style = {styles.imageView}/>
Run Code Online (Sandbox Code Playgroud)

我的代码位于项目目录中名为 Modules 的目录中。我的项目名称是 test,我的 Json 文件位于名为“Reducers”的目录中,reducers 也位于项目目录中,我的图像位于名为 …

reactjs react-native

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

请求的资源上存在“Access-Control-Allow-Origin”标头

我正在尝试从 angular 应用程序连接到我的 .net 核心 API。当我尝试这样做时,我收到一条错误消息:

Access to XMLHttpRequest at 'https://localhost:44378/api/recloadprime' from origin 'http://localhost:4200' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Run Code Online (Sandbox Code Playgroud)

下面是来自我的 angular 应用程序的控制台消息:

在此处输入图片说明

这是我为解决错误所做的工作。我在 startup.cs 文件的 ConfigureServices 方法中添加了 services.addCors :

public void ConfigureServices(IServiceCollection services)
    {

        services.AddCors(options =>
        {
            options.AddPolicy("AllowAnyCorsPolicy", policy => policy.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin());
        });

        services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
            services.AddControllers();
           services.AddDbContext<db_recloadContext>();

    }
Run Code Online (Sandbox Code Playgroud)

在configure方法中,我放了以下代码:

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();

            }
            else
            {
                app.UseHsts();
            }
           app.UseCors("AllowAnyCorsPolicy");
           app.UseHttpsRedirection();
           app.UseRouting();
           app.UseAuthorization();
           app.UseEndpoints(endpoints =>
            { …
Run Code Online (Sandbox Code Playgroud)

cors .net-core asp.net-core-webapi angular

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

Xamarin 形式的图像按钮

我对 Xamarin 很陌生。我需要在我的 Xamarin 应用程序上添加一个显示 Facebook 图标的图像按钮,当用户单击该图标时,我需要重定向到http://www.facebook.com。我怎样才能做到这一点。这是我到目前为止所拥有的

 <StackLayout Padding="50">



  <Image Source="facebook.png" HeightRequest="80"  WidthRequest="80"  >
    <Button Text="Mission" Clicked="Mission_Clicked"></Button>
    <Button Text="Continue" Clicked="Continue_Clicked"></Button>

</StackLayout>
Run Code Online (Sandbox Code Playgroud)

在点击 Facebook 时,我只想在手机上显示 Facebook 页面。

任何帮助将不胜感激。

xamarin xamarin.forms

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

Mac 电脑上找不到 adb 命令

我正在尝试在我的 mac 计算机上定义 android_home 路径。以下是我所做的:

vi ./bash_profile

在 vi 编辑器中,我有以下命令:

在此输入图像描述

我的android sdk位置如下:

在此输入图像描述

当我保存 vi 编辑器并运行 adb 命令时。我收到一条错误消息

-bash:adb:找不到命令

我现在是Mac电脑。我不确定我做错了什么。谁能帮我这个。

reactjs react-native

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