小编Ami*_*mir的帖子

无法在UBuntu 18.04上安装.Net Core 2.2

我试图将ASP.NET Core 2.2应用程序部署到运行Ubuntu 18.04的DigitalOcean droplet.我按照官方文件中提供的步骤进行操作. https://dotnet.microsoft.com/download/linux-package-manager/ubuntu18-04/sdk-current.

但是我收到了错误.

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 dotnet-sdk-2.2 : Depends: aspnetcore-runtime-2.2 (>= 2.2.0) but it is not going to be installed
                  Depends: dotnet-runtime-2.2 (>= 2.2.0) …
Run Code Online (Sandbox Code Playgroud)

ubuntu .net-core ubuntu-18.04

20
推荐指数
2
解决办法
6533
查看次数

如何使用@aspnet/signalr 库修复 reactnative 中的“错误:无法启动传输‘WebSockets’:null”?

连接到服务器时,我一直无法启动传输 'WebSockets': null。

我正在 reactnative 移动应用程序中实现一个简单的聊天。我正在使用 @aspnet/signalr(version-1.1.4) 库。我收到此错误 - 错误:无法启动传输“WebSockets”:空。 在此处查看日志 我在 chrome 中得到以下日志

componentDidMount(){

try {

      const connection = new signalR.HubConnectionBuilder() //Connect to a hub
        .withUrl(baseUrl + `/chatbus`, {
          transport: signalR.HttpTransportType.WebSockets | signalR.HttpTransportType.LongPolling,
          'content-type': 'application/json',
          accessTokenFactory: () => authToken   //for authorization
        })
        .configureLogging(signalR.LogLevel.Debug)
        .build();

      connection.on('NotifySignalR', (ChatObject) => {
        console.log(ChatObject);

      });

      connection.start()
        .then(() => {
          console.log('Chat Connection started.');
          console.log('Now connected, connection ID=' + connection.id);
          this.initalAttemptForChat = true;
          connection.invoke("start");
        })
        .catch(() => {
          this.initalAttemptForChat = false;
          console.log('Error while establishing chatbus connection!');
        });

    } catch …
Run Code Online (Sandbox Code Playgroud)

signalr react-native

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

将图像上传到Web Api 2使用角度5

我看了几个问题和答案,但无法解决我的问题.我的代码如下:

HTML

 <input type="file" id="file" accept="image/*" name="File" (change)="handleFileInput($event.target.files)">
 <button type="button" mat-raised-button color="primary" (click)="uploadFileToActivity()">Upload</button>
Run Code Online (Sandbox Code Playgroud)

零件

  handleFileInput(files: FileList) {
    this.fileToUpload = files.item(0);
  }

  uploadFileToActivity() {

    this._dishAddService.postFile(this.fileToUpload).subscribe(data => {

      }, error => {
        console.log(error);
      });
  }
Run Code Online (Sandbox Code Playgroud)

服务

 postFile(fileToUpload: File): Observable<boolean> {
    const formData: FormData = new FormData();
    formData.append('fileKey', fileToUpload, fileToUpload.name);
    let headers = new Headers({ 'Content-Type': 'application/json' });    
    headers.append('Content-Type', 'multipart/form-data');

    let options = new RequestOptions({ headers: headers, method: 'post' });
    return this.http.post(this.httpRequestUrl + 'api/dish/UploadDishImage', formData, options)
      .map(
        (response => response.json()))
      .catch(CommonFunctionService.handleError);
  }
Run Code Online (Sandbox Code Playgroud)

API …

form-data asp.net-web-api2 angular

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

升级到 Angular 16 中断 Sharepoint 广告: this._history.replaceState 不是函数

我正在升级在 Share Point 办公室内运行的 Angular 应用程序。目前 Angular 应用程序使用的是版本 14,在我升级到 Angular 15 后,它工作正常。但是当我升级到 16 后,我就收到以下错误。

TypeError: this._history.replaceState is not a function
Run Code Online (Sandbox Code Playgroud)

打电话时会发生这种情况

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

我在这个 SO 帖子上找到了修复。Office.js 使浏览器历史记录功能无效,破坏历史记录使用情况

<script type="text/javascript">
    // Office js deletes window.history.pushState and window.history.replaceState. Cache them and restore them
    window._historyCache = {
        replaceState: window.history.replaceState,
        pushState: window.history.pushState
    };
</script>

<script type="text/javascript" src="https://appsforoffice.microsoft.com/lib/1/hosted/office.js"></script>

<script type="text/javascript">
    // Office js deletes window.history.pushState and window.history.replaceState. Restore them
    window.history.replaceState = window._historyCache.replaceState;
    window.history.pushState = window._historyCache.pushState;
</script>
Run Code Online (Sandbox Code Playgroud)

我不确定升级到 Angular 16 后会发生什么问题,尽管它与 office.js 有关

我正在使用相同版本的office.js。

我已经使用了哈希位置策略。任何人都可以帮助我理解这一点。

office-addins angular-ui-router office-js angular angular16

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

模板解析错误:“ mat-sidenav-container”不是已知元素

我是Angular / material2的新手,我不确定尝试遵循上的文档时会丢失什么sidenav

在我的AppComponent中,我想显示一个sidenav,并实现如下:

app.component.tss

import {
    NgModule,
    Component
} from '@angular/core';
import {
    MatSidenavModule,
    MatSidenavContent,
    MatSidenav
} from '@angular/material';
import {
    BrowserAnimationsModule
} from '@angular/platform-browser/animations';

@NgModule({
    imports: [
        BrowserAnimationsModule,
        MatSidenav
    ],
    exports: [
        BrowserAnimationsModule,
        MatSidenav
    ]
})
@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent {
    title = 'app';
}
Run Code Online (Sandbox Code Playgroud)

app.component.html

<!--The content below is only a placeholder and can be replaced.-->
<mat-sidenav-container>

</mat-sidenav-container>
<div style="text-align:center">
    <h1>
        Welcome to {{ title }}!
    </h1>
    <nav> …
Run Code Online (Sandbox Code Playgroud)

angular

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

Angular 2:Array.push无法正常工作

当我将项目推入数组时,项目被推送,但问题是数组中的所有项目都与推送的最后一项相同.

pushspecification() {
        this.specificationSaveDetailList.push(this.specificationsaveDetail);
    }
Run Code Online (Sandbox Code Playgroud)

以下是plunker代码:plunker_Code
在这个plunker示例中,我从下拉列表中选择项目并提供说明并单击"添加"按钮,表中将填充数组项.

javascript typescript angular

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