我正在尝试实施 Application Insights 日志记录。
这是我的启动
在配置服务下
services.AddApplicationInsightsTelemetry(Configuration["ApplicationInsights:InstrumentationKey"]);
Run Code Online (Sandbox Code Playgroud)
这是我的控制器
private readonly My_DevContext _context;
private Task t;
private readonly IKipReport _kipReport;
private readonly ILogger _logger;
public ReportExtractionController(ILogger logger,My_DevContext context, IKipReport kipReport)
{
_context = context;
_kipReport = kipReport;
_logger = logger;
}
// GET: api/<RepprtExtractionController>
[HttpGet]
public async Task<IActionResult> Get()
{
_logger.LogError("Trial");
}
Run Code Online (Sandbox Code Playgroud)
尝试调用 API 时显示500,内部服务器错误
System.InvalidOperationException: Unable to resolve service for type 'Microsoft.Extensions.Logging.ILogger' while attempting to activate 'Toolset_API.Controllers.ReportExtractionController'.
at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetService(IServiceProvider sp, Type type, Type requiredBy, Boolean isDefaultParameterRequired)
at lambda_method10(Closure , …Run Code Online (Sandbox Code Playgroud) 我有一个代码片段来修改.在那里我发现了这样的语法.
Session("LightBoxID")?.ToString()
Run Code Online (Sandbox Code Playgroud)
我不明白那个问号(?)是什么意思.没有谷歌搜索帮助我任何提示
我正在 Angular 9.1.4 节点 14.0 上工作。
现在我遇到了一个麻烦,那就是每当尝试跑步时
ng serve
Run Code Online (Sandbox Code Playgroud)
它需要很长时间才能启动。我正在尝试编译一个从 themeforest 获得的主题。npm install完全没有安装问题,一切正常,我还更新了packages.json 中的所有包。
服务命令仍然很慢
我有一个基本的SQL表,每行之间有一个简单的层次连接.也就是说,每行都有一个ParentID,并使用它与另一行连接.其内容如下
AccountID | AccountName | ParentID
---------------------------------------
1 Mathew 0
2 Philip 1
3 John 2
4 Susan 2
5 Anita 1
6 Aimy 1
7 Elsa 3
8 Anna 7
.............................
.................................
45 Kristoff 8
Run Code Online (Sandbox Code Playgroud)
希望结构清晰
但我对listng的要求有点奇怪.那是当我们传递一个AccountID时,它应该列出所有的父母和兄弟姐妹和兄弟姐妹的孩子.但它永远不会将该AccountID的任何子项列入任何级别.我可以用图片更详细地解释一下.对不起,图片清晰..我的是一个旧的手机摄像头..

当我们传递AccountID 4时,它应列出所有父母及其兄弟姐妹,但不应列出4,6,7,8,9,10.这意味着应该在结果中避免帐户及其中的任何子项(基于图片树元素).希望解释清楚.
我有一个这样的类,对于这种类型,我需要反序列化一个JSON字符串
public class nodes
{
public int id{get;set;}
public string name{get;set;}
public List<nodes> children{get;set;}
}
Run Code Online (Sandbox Code Playgroud)
而JSON就是这样的
{
id: 15,
name: 'user1',
children: [
{
id: 22,
name: 'user2',
children: [
{
id: 34,
name: 'user3',
children: [
{
id: 43,
name: 'user4',
children: []
},
{
id: 54,
name: 'user5',
children: []
}
]
},
{
id: 65,
name: 'user6',
children: []
}
]
},
{
id: 72,
name: 'user7',
children: []
}
]
}
Run Code Online (Sandbox Code Playgroud)
这就是我反序列化的方式
node d=JsonConvert.DeserializeObject<node>(myJSON); //myJSON is …Run Code Online (Sandbox Code Playgroud) 我是 MSAL 新人。因此,我只遵循从此处实现它的基本设置https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-angular/README.md。
\n我所做的是像这样在 app.module 中设置配置
\n MsalModule.forRoot({\n auth: {\n clientId: \'myclientid\', // This is your client ID\n authority: \'https://login.microsoftonline.com/mytenantid\', // This is your tenant ID\n redirectUri: \'http://localhost:4200\'// This is your redirect URI\n \n },\n cache: {\n cacheLocation: \'sessionStorage\',\n storeAuthStateInCookie: isIE, // Set to true for Internet Explorer 11\n },\n }, {\n popUp: !isIE,\n consentScopes:\xc2\xa0[\n \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\'user.read\',\n \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\'openid\',\n \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\'apiappid/user_impersonation\',\n \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0], \n unprotectedResources: [],\n protectedResourceMap:\xc2\xa0[\n \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0[\n \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\'https://localhost:44331/\',\n \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0[\'apiappid/user_impersonation\'],\n \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0]\n \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\n \xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0], \n extraQueryParameters: {}\n })Run Code Online (Sandbox Code Playgroud)\r\n嗨,我正在使用 HTML2canvas 插件在模态对话框中转换 DIV。转换工作正常。但是那个 div 有垂直滚动。所以在最终图像上,滚动隐藏区域后没有任何转换。只有 div 的可见顶部在渲染图像中。那么如何将整个 div(与滚动无关)转换为图像..这是我的代码
$('#modal_sidebyside .modal-content').html2canvas({
onrendered: function (canvas) {
//Set hidden field's value to image data (base-64 string)
$('.export-sidebyside').hide();
//$('#modal_sidebyside .modal-body').css({ 'overflow-y': 'auto', 'height': 'auto' });
//$('#modal_sidebyside .modal-content').css({ 'overflow-y': 'auto', 'height': 'auto' });
var img = canvas.toDataURL('image/jpeg');
var link = document.getElementById("download-sidebyside");
link.download = "SidebySide.jpg"; //Setup name file
$(link).html("Download");
link.href = img.replace(/^data[:]image\/(png|jpg|jpeg)[;]/i, "data:application/octet-stream;");
$('.export-sidebyside').show();
// $('#modal_sidebyside .modal-body').css({ 'overflow-y': 'auto', 'height': '80%' });
// $('#modal_sidebyside .modal-content').css({ 'overflow-y': 'auto', 'height': '100%' });
//document.body.appendChild(link);
}
});
Run Code Online (Sandbox Code Playgroud) 我试图只在一个数据表中启用基于一列的排序.但它不起作用.这是我尝试的方式
var myTable = $("#tbl_main").dataTable({
"dom": "<'tableinfobar'i><'tablesearchbox'f><'tablestarfilter'><'tablebody't>S<'tablelength'l><'tablepaging'p>",
"ordering": false,
"columnDefs": [{"targets": [0, 6],"searchable": false}, {"targets":2, "type":"html-num","orderable":true}],
"lengthMenu": [
[10, 20, 50, 100, 500, -1],
[10, 20, 50, 100, 500, "All"]
]
}).show();
Run Code Online (Sandbox Code Playgroud)
在这里,我只需要为第二列启用排序,并在columnDefs中尝试
我面临着 JQUERY Datatable 插件的一个奇怪问题。我在每一行中都使用了一个评级功能。第一个单元格实际上拥有用于该目的的控制权。
这是第一个单元格的标记
<input class="row-check" type="checkbox"><span class="fa-stack fa-lg star-rating">
<i class="fa fa-star goldstar fa-stack-2x"></i>
<strong class="fa-stack-1x inside-text">4</strong> </span>
Run Code Online (Sandbox Code Playgroud)
这是我使用的数据表初始化代码
var myTable = $("#tbl_main").dataTable({
"dom": "<'tableinfobar'i><'tablesearchbox'f><'tablestarfilter'><'tablestarreset'><'tablebody't>S<'tablelength'l><'tablepaging'p>",
"ordering": true,
"columnDefs": [{ "targets": [0, 6], "searchable": false, "orderable": false },
{ "targets": [ 1, 3, 4, 5, 7, 8, 9], "orderable": false },
{ "targets": [2], "type": "html-num", "orderable": true}],
"lengthMenu": [
[10, 20, 50, 100, 500, -1],
[10, 20, 50, 100, 500, "All"]
],
"language": {
"search": "Quick Search _INPUT_", …Run Code Online (Sandbox Code Playgroud) 当我将基于 js 的 React 应用程序转换为打字稿时,出现以下错误。
Type 'FunctionComponent<SVGAttributes<SVGElement>>' is not assignable to type 'string'.ts(2322)
index.d.ts(2188, 9): The expected type comes from property 'src' which is declared here on type 'DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>'
Run Code Online (Sandbox Code Playgroud)
下面是我的 App.tsx 文件
import React from 'react';
import logo from './logo.svg';
import './App.css';
function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.tsx</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
);
}
export …Run Code Online (Sandbox Code Playgroud) c# ×3
jquery ×3
angular ×2
datatables ×2
sql ×2
asp.net ×1
asp.net-core ×1
html2canvas ×1
json.net ×1
jwt ×1
reactjs ×1
sql-server ×1
typescript ×1
vb.net ×1