我确实将我的应用程序升级到aspnetcore 2.2,但是由于一些遗留的限制,我打算以后删除这些限制,因此我必须以.NET Framework为目标。
新的托管模型InProcess带来了改进,因此我想使用它,但是当我部署到Azure时,我得到了错误。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<!--AspNetCoreModuleV2 switch back when its released on azure-->
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\Flymark.Online.Web.exe" arguments="" stdoutLogEnabled="true" stdoutLogFile="../stdout" hostingModel="InProcess" />
</system.webServer>
</location>
</configuration>
Run Code Online (Sandbox Code Playgroud)
还有我的错误
HTTP错误500.0-ANCM进程内处理程序加载失败导致此问题的常见原因:找不到指定版本的Microsoft.NetCore.App或Microsoft.AspNetCore.App。在应用程序中未引用进程内请求处理程序Microsoft.AspNetCore.Server.IIS。ANCM找不到dotnet。故障排除步骤:检查系统事件日志中是否有错误消息启用日志记录应用程序进程的标准输出消息将调试器附加到应用程序进程并检查有关更多信息,请访问:https : //go.microsoft.com/fwlink/?LinkID=2028526
如果我将同一个应用程序更改为进程外和模块到v1,则它将按预期工作
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<!--AspNetCoreModuleV2 switch back when its released on azure-->
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\Flymark.Online.Web.exe" arguments="" stdoutLogEnabled="true" stdoutLogFile="../stdout" hostingModel="OutOfProcess" />
</system.webServer>
</location>
</configuration> …Run Code Online (Sandbox Code Playgroud) 我有一个应用程序,它显示带有个人资料图片的用户列表。当我更新此用户的值时,图像会重新加载,因为可观察列表再次发出所有数据。我怎样才能避免这种情况?
<div *ngFor="let user of users">
<img [src]="user.profilepic"/> {{user.name}} <button (click)="updateUser(user)">Update</button>
</div>
Run Code Online (Sandbox Code Playgroud)
TS :
this.userProvider.getUserList()
.distinct()
.subscribe(data => {
this.users = data
})
Run Code Online (Sandbox Code Playgroud)
我希望这个 distinct() 函数可以完成这项工作,但没有成功。该应用程序是用 ionic 3 结合 firebase 实时数据库数据和使用公共 url 下载的 firebase 存储图片制作的
编辑
3 年后,我在另一个应用程序中遇到了同样的问题......每次从我的 Observable 进入时,图像都会闪烁(所以我认为它会刷新?)
对于用户机密管理,我在开发阶段使用用户机密,并希望使用 Azure 密钥保管库进行发布和暂存。我有这个配置
"ConnectionStrings": {
"DefaultConnection": "MySecretConnectionString"
},
"SmtpSettings": {
"SmtpMailServer": "smtp.mailserver.somewhere",
"SmtpPort": "465",
"SenderLogin": "login",
"SenderDisplayName": "Site ",
"SenderPassword": "password",
"SenderEmail": "site@mailserver.somewhere",
"SecureSocketSettings": "SslOnConnect"
}
Run Code Online (Sandbox Code Playgroud)
当我想要在 Azure 密钥保管库中设置ConnectionStrings:DefaultConnection或存储时,就会出现问题。SmtpSettings:SenderPassword
有什么方法可以为嵌套属性分配和使用值吗?例如,就像我对用户机密所做的那样
dotnet user-secrets set "SmtpSettings:SenderPassword" "########" --project MyProject
Run Code Online (Sandbox Code Playgroud)
但对于 Azure 密钥保管库
az keyvault secret set --name "SmtpSettings:SenderPassword" --value "######" --vault-name MyProjectVault
Run Code Online (Sandbox Code Playgroud)
: 不允许,Parameter 'secret_name' must conform to the following pattern: '^[0-9a-zA-Z-]+$'.
connection-string appsettings azure azure-keyvault asp.net-core
我有一个应用程序,我正在其中进行 html5 拖放以进行类别排序,因此用户可以选择类别并将其移动到他想要的地方。
一切都很好,但有时类别列表很大,如果用户需要向下移动它,他们想使用鼠标滚轮滚动,但问题是在 Dragstart 之后,不会触发此事件。
附言。是的,如果光标移至底部,则浏览器将滚动,但在我的应用程序中,用户体验很重要,因为有时他们要对 50 个类别进行排序,并且需要花费大量时间
这是示例代码,如果您开始拖动鼠标上的 div 和滚轮,则不会将事件打印到控制台,这意味着事件不会被触发。
<!DOCTYPE html>
<html>
<head>
<script>
function allowDrop(ev) {
ev.preventDefault();
}
function drag(ev) {
ev.dataTransfer.setData("text", ev.target.id);
}
document.addEventListener("wheel", function(e){
console.log(e);
}, false);
</script>
</head>
<body>
<div id="drag1" draggable="true"
ondragstart="drag(event)" width="336" height="69" style=" border: 1px solid #aaaaaa;">Dragg me</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我想像这样在离子无限内显示自定义加载器
<ion-infinite-scroll (ionInfinite)="doInfinite($event)">
<spinner [color]="'white'"></spinner>
</ion-infinite-scroll>
Run Code Online (Sandbox Code Playgroud)
但问题是旋转器总是可见的,因为我看到无限滚动具有属性,state并且它的离子无限滚动内容的修改属性设置状态属性,并且有隐藏它的css.
我的问题是,任何身体都做过任何自定义微调器或只有自定义微调器的方法是使用css类吗?
所以基本上它看起来像这样
我需要在我的页面上加载近20种声音.我想也许我需要分别加载2个元素,这就是为什么你会看到inProgress属性
loadAudio: function () {
if (this.inProgress <= 1) {
this.inProgress++;
var elem = this.audioQueue.pop();
if (elem != null) {
var path = elem.Path + elem.Fileid + ((this.canPlayMp3) ? '.mp3' : '.wav');
audio = new Audio();
audio.src = "http://localhost:55578/~/x.mp3";
audio.addEventListener('loadedmetadata', function (e) { AudioPlayer.audioLoaded(e); }, false);
//audio.addEventListener('loadeddata', function (e) { AudioPlayer.audioLoaded(e); }, false);
audio.addEventListener('error', function (e) { AudioPlayer.audioLoaded(e); }, false);
if (elem.AudioType == AudioPlayerTypes.Keyboard) {
this.keyboardAudio[elem.Id] = audio;
}
}
}
audioLoaded: function (e) {
var t = e.target;
if …Run Code Online (Sandbox Code Playgroud) 我在打字稿中有 e2e 测试的 angular 应用程序,我想在 VSCode 中运行调试。我去read.me看看如何运行调试,这很容易。但我的问题是打字稿测试中的断点并没有停止。正如我所见,我有未生成的源映射问题。
配置文件
{
"compileOnSave": true,
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"target": "es5",
"typeRoots": [
"../node_modules/@types"
]
}
}
Run Code Online (Sandbox Code Playgroud)
启动文件
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/protractor/bin/protractor",
"stopOnEntry": false,
"sourceMaps": true,
"cwd": "${workspaceRoot}",
"args": [
"${workspaceRoot}/protractor.conf.js"
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
量角器配置文件
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/docs/referenceConf.js
/*global jasmine */
var SpecReporter …Run Code Online (Sandbox Code Playgroud) 我有可观察的扩展.它工作得很好,但现在我已经更新到角度为6的打字稿2.7.2.
import { Observable } from 'rxjs/Observable';
import { BaseComponent } from './base-component';
import { Subscription } from 'rxjs/Subscription';
import { Subscribable } from 'rxjs';
declare module 'rxjs/Observable' {
export interface Observable<T> {
safeSubscribe<T>(this: Observable<T>, component: BaseComponent,
next?: (value: T) => void, error?: (error: T) => void, complete?: () => void): Subscription;
}
}
export function safeSubscribe<T>(this: Observable<T>, component: BaseComponent,
next?: (value: T) => void, error?: (error: T) => void, complete?: () => void): Subscription {
let sub = this.subscribe(next, …Run Code Online (Sandbox Code Playgroud) 我的任务是在网站上更改smth时获取内容的网址.它就像CRUD操作日志记录(在我的情况下,我正在将该URL记录到其他系统进行进一步处理).它应该适用于版本6及更高版本.
当我开始它似乎很简单订阅事件然后采取项目并生成它的URL.我订阅了两个事件发布:itemProcessing(因为此处只有项目尚未从Web数据库中删除),发布:itemProcessed(用于添加和更新).
这个事件给了我时间对象Item,所以看起来像这样的url非常简单
var options = LinkManager.GetDefaultUrlOptions();
options.AlwaysIncludeServerUrl = true;
options.SiteResolving = true;
var url = LinkManager.GetItemUrl(item, options);
Run Code Online (Sandbox Code Playgroud)
在这里我的问题开始了.首先,我需要有正确的网址,并以同样的方式,因为它是在网站上产生的,但这里的URL返回我像水木清华" HTTP://domain/sitecore/content/Home.aspx ".
所以我添加了新的方法来从网站定义中找到正确的网站
private List<KeyValuePair<string, SiteContext>> GetSites()
{
return SiteManager.GetSites()
.Where(
s =>
!string.IsNullOrEmpty(s.Properties["rootPath"]) &&
!string.IsNullOrEmpty(s.Properties["startItem"]))
.Select(
d => new KeyValuePair<string, SiteContext>($"{d.Properties["rootPath"]}{d.Properties["startItem"]}",
new SiteContext(new SiteInfo(d.Properties))))
.ToList();
}
public virtual SiteContext GetSiteContext(Item item)
{
var site = _sites.LastOrDefault(s => item.Paths.FullPath.ToLower().StartsWith(s.Key.ToLower()));
return site.Value;
}
options.Site = GetSiteContext(Item item);
Run Code Online (Sandbox Code Playgroud)
再次问题没有解决,因为sitecore返回" http://127.0.0.1/en.aspx "
然后我继续阅读并理解网站定义应该有targetHostName(它实际上是有意义的,因为一个网站可以有多个域)但是当我现在添加targetHostName时它会返回其他链接" ://targetHostName/en.aspx "所以http | https不见了.第二个问题是,它返回我EN.aspx这意味着这个页面可以访问扔HTTP://targetHostName/en.aspx …
我正在编写将替换旧应用程序的应用程序等第一步,不幸的是,我必须同步数据
我的班级看起来像那样
public class Program
{
[Key]
public int ProgramIndex { get; set; }
public string ProgramName { get; set; }
public string EnglishName { get; set; }
public string ExtraData { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我正在为这个项目使用 sqlite,它允许指定 ProgramIndex 或者它会为我生成。
但是,如果我尝试使用 entityframework 插入并指定索引,它将失败。我可以通过向索引属性添加属性来解决这个问题
[DatabaseGenerated(DatabaseGeneratedOption.None)]
Run Code Online (Sandbox Code Playgroud)
但问题是我只需要在同步数据时禁用自动增量。
所以我的问题是有没有办法即时设置 DatabaseGeneratedOption.None ?
我已将我的项目迁移到 asp.net core 3.1,但是当我部署到 azure web 应用程序时,它无法启动。
显示错误
HTTP 错误 500.31 - ANCM 无法找到本机依赖项 此问题的常见解决方案:找不到指定版本的 Microsoft.NetCore.App 或 Microsoft.AspNetCore.App。故障排除步骤: 检查系统事件日志中的错误消息 启用记录应用程序进程的标准输出消息 将调试器附加到应用程序进程并检查
<EventData>
<Data>Could not find 'aspnetcorev2_inprocess.dll'. Exception message:
Invalid runtimeconfig.json [D:\home\site\wwwroot\Flymark.Online.Web.runtimeconfig.json] [D:\home\site\wwwroot\Flymark.Online.Web.runtimeconfig.dev.json]
</Data>
<Data>Process Id: 23260.</Data>
<Data>File Version: 13.1.20074.3. Description: IIS ASP.NET Core Module V2. Commit: e81033e094d4663ffd227bb4aed30b76b0631e6d</Data>
</EventData>
Run Code Online (Sandbox Code Playgroud)
或者
<EventData>
<Data>Could not find 'aspnetcorev2_inprocess.dll'. Exception message:
Failed to load the dll from [D:\home\site\wwwroot\hostpolicy.dll], HRESULT: 0x8007007E
An error occurred while loading required library hostpolicy.dll from [D:\home\site\wwwroot\]
</Data>
<Data>Process Id: 21176.</Data>
<Data>File …Run Code Online (Sandbox Code Playgroud) angular ×5
azure ×3
c# ×3
typescript ×3
asp.net-core ×2
javascript ×2
rxjs ×2
appsettings ×1
audio ×1
firebase ×1
html ×1
html5 ×1
iis ×1
ionic2 ×1
observable ×1
protractor ×1
rxjs6 ×1
sitecore ×1
sitecore6 ×1