前言:我知道一般意义上这是如何完成的,我的问题是如何在 Azure 应用服务上最好地设置它
a) 在 Azure 应用服务托管的 Rest 服务(应用程序#1)上的 CORS 配置在哪里完成?是否是通过 C# 代码的传统方式,例如 config.EnableCors(); 或者也可以通过 Azure Portal 魔法来完成?
b) 如果客户端应用程序 (App-#2) 托管在(另一个)Azure 应用服务上,则在哪里可以找到将在 Ajax 调用中发送到 App-#1 的外部 IP 地址?
我有一个XML模式(XSD),它将元素定义为必需元素(称之为父元素); 例如,这个父级有五个子元素,它们都可以是可选的,但必须至少有一个子元素.
我怎样才能在xsd中指定这个?
澄清:孩子是不同的元素和可选的.例如.
<Parent>
<Child1>contents are different to other siblings and arbitrary</Child1>
<Child2>can be text, a simple element, or another complex element</Child2>
<Child3>etc.. etc</Child3>
</Parent>
<xs:complexType name="Parent">
<xs:sequence>
<xs:element minOccurs="0" name="Child1" type="xs:string"/>
<xs:element minOccurs="0" name="Child2" />
<xs:element minOccurs="0" name="Child3" />
</xs:sequence>
</xs:complexType>
Run Code Online (Sandbox Code Playgroud)
即使每个孩子都是可选的,父母也需要至少有一个孩子.
我有一个Visual Studio 2012解决方案,其中包含一些项目.每次打开解决方案文件时,我都会收到消息:
找不到解决方案的映射.
由于服务器不可用,活动解决方案已暂时与源控制断开连接.要尝试重新连接到源控件,请在服务器可用时关闭然后重新打开解决方案.如果要将此解决方案连接到其他服务器,请使用"更改源代码管理"对话框.
我想要做的是永久删除任何提到的源代码控制,但到目前为止没有运气.
除了上面描述的消息(暂时断开连接等)之外,无论我删除了多少次,以下4行总是会添加到解决方案文件中.
SccProjectName ="MyApp"
SccAuxPath ="https://some.annoying.domain.com/VaultService"
SccLocalPath ="4~89a6b376-099d-49a7-801a-2ba7adb0e268"
SccProvider ="SourceGear Vault Visual Studio 2005客户端:{7BE9CE03- 56BF-4682-9C06-78C68B134B30}"
这4行位于描述网站项目的部分内.
项目("{E24C65DC-7377-472B-9ABA-BC803B73C61A}")="MyApp",
"http://localhost/MyApp","{A5301379-1092-419E-9B03-E37E16E0A8B2}"
ProjectSection(WebsiteProperties)= preProject
我强烈怀疑是网站项目搞砸了.但网站项目在哪里持有源控制信息?
我已经搜索了所有文件内容的字符串"some.annoying.domain.com",但没有任何意义(在其他解决方案中找到,而不是这个特定的解决方案).
该解决方案似乎最初是在VS2010中创建的(之前的开发人员显然使用了SourceGear的Vault产品).
**注意:我可以尝试将网站proj更改为网络应用程序项目,看看它是怎么回事,但这不是重点.
在SQL 2000 /查询分析器中,我曾经能够将Windows资源管理器中的T-SQL脚本文件拖放到查询分析器上.
在SQL 2008/Management Studio中不能这样做吗?
我显然可以这样做:文件/打开/文件...导航到文件然后打开它.
但有人请告诉我,有一种更简单的方式,就像在2000年!
编辑16/7/10:终于开始试用家用电脑,按预期工作.Workplace在a/c登录时有一些限制(NT用户策略).使用查询分析器,我'运行为'另一个空调和拖放工作在登录用户下工作; 使用Management Studio,i'Run As'另一个a/c和拖放功能在登录用户下无效.
我试图实现以下布局,如截图所示.

主要特点是
使用HTML表格花了我大约2个小时来生成上面的截图,具有上述功能.
在用CSS填充两天之后,我无法看到它如上所述,我对CSS和相关屏幕截图的尝试如下:
<html>
<head>
<title>My Layout</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
body{
height:100%;
background:beige;
}
#header {
width:100%;
height:60px;
text-align:center;
background:#A7C942;
color:#fff;
float:left;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size:2em;
}
#leftDiv {
float:left;
width:150px;
height:90%;
background:aquamarine;
}
#midDiv {
float:left;
width:auto;
height:90%;
background:lightsalmon;
display:block;
}
#rightDiv {
float:right;
width:365px;
height:90%;
background:green;
display:block;
}
#topRow {
background-color:lightgoldenrodyellow;
}
#bottomRow {
background-color:lightpink;
height:200px;
}
</style>
</head>
<body>
<div id="body">
<div id="main">
<div …Run Code Online (Sandbox Code Playgroud) 所以我在创建脚本时一直盲目地使用ansi_nulls on、quoted_identifier on,因为sqlserver在编写对象脚本时会自动生成它们。
我真的没有时间关心这些琐碎的废话:-)但我想必须提出这些问题。
鉴于这些是推荐的设置,是否有一个选项可以设置(a)每个数据库和(b)每个服务器,以便它们默认情况下始终处于打开状态,而不是通过单独的脚本?
如果是这样,如何/在哪里可以查看当前的默认设置?
在本地主机上工作时,假定应用程序位于本地开发服务器的根目录上
本地主机:50001/index.html
但是当部署到远程 IIS 服务器时,还有其他 Web 应用程序在那里运行,并且每个单独的应用程序都必须创建为“应用程序”(IIS 术语)
例如,“默认网站”在端口 80 上;其他应用程序(也在端口 80 上)有自己的 AppName。
MYSERVERNAME/App1/
MYSERVERNAME/App2/
MYSERVERNAME/MyReactApp/
所以现在要访问我的 React 应用程序,我有一个额外的路径 http://MYSERVERNAME/MyReactApp/index.html
'npm run build' 生成的 index.html 包含绝对路径;为了使我的部署工作,我手动编辑了 index.html 以包含相对路径
因此,例如,而不是:
<script type="text/javascript" src="/static/js/main.d17bed58.js"></script>
Run Code Online (Sandbox Code Playgroud)
我在所有路径前添加了一个 .(dot) 以获得:
<script type="text/javascript" src="./static/js/main.d17bed58.js"></script>
Run Code Online (Sandbox Code Playgroud)
这主要有效,并且所有脚本最初都会加载。但我对结果并不满意,因为我在应用程序中单击的任何链接和客户端路由(即来自 react-router)将恢复为假设该应用程序托管在网络服务器的根目录上。IE
此外,如果我直接在浏览器上输入任何链接(或刷新页面),它显然会失败。
回顾一下。问题是我需要在部署到 IIS 时始终保持“真实”路径http://MYSERVERNAME/myReactApp。怎么做?
使用 jQuery Ajax 时,在浏览器控制台中,我可以看到 xhr 对象有两个 props/字段,采用一些奇怪的符号 [双方括号,在这种情况下不认为它意味着数组];
\n首先,它们到底是什么,其次,我可以从 JavaScript 代码访问这些值吗?
\n[[FunctionLocation]]: jquery-3.3.1.min.js:2\n[[Scopes]]: Scopes[4]\n0: Closure (w.Callbacks) {e: {\xe2\x80\xa6}, t: undefined, n: "", r: undefined, i: Array(0), \xe2\x80\xa6}\n1: Closure {e: Window, r: document, i: \xc6\x92, o: \xc6\x92, a: \xc6\x92, \xe2\x80\xa6}\n2: Script {loc: Location, baseRestURL: "http://localhost:60123/MyVirtualDir"}\n3: Global {parent: Window, opener: null, top: Window, length: 0, frames: Window, \xe2\x80\xa6}\nRun Code Online (Sandbox Code Playgroud)\n\n 这是我尝试过的 - 就看到 UI 刷新而言,它有效,但我不认为这是 async/await 的最佳用途。我该如何改进?
private async void btnQuickTest_Click(object sender, RoutedEventArgs e)
{
XmlReader reader;
int rowCount = 0;
using (reader = XmlReader.Create("someXmlFile.xml"))
{
while (reader.Read())
{
rowCount++;
DoSomeProcessingOnTheUIThread(reader);
//only update UI every 100 loops
if (rowCount > 0 && rowCount % 100 == 0)
{
//yay! release the UI thread
await Task.Run(() =>
{
Application.Current.Dispatcher.Invoke(
() =>
{
txtRowCount.Text = string.Format("{0}", rowCount);
});
});
}
} //end-while
}//end-using
}
Run Code Online (Sandbox Code Playgroud)
什么是更好的方法?
更新: 我根据 Clemens 的回答,通过将处理发送到后台任务,并直接更新 UI 上的进度,避免了 Dispatcher.Invoke。我的代码现在看起来像。 …
Winforms 2.0.在表单上粘贴DateTimePicker.它默认为今天.单击下拉箭头以显示日历,然后单击"今天".ValueChanged事件已发生火灾,即使它已设置为今天.
我想要做的是复制相同的功能 - 我想将它(在代码中)重置为今天,下次我通过日历点击今天我想要触发ValueChanged事件(就像它第一次做的那样) ).
如果以上是不可能的,我想要一些事件总是在我在日历上选择日期时触发(无论是否有变化或没有变化).
听起来很简单,肯定有人有答案吗?
AppBar 总是在 Drawer 和 Content 之上;这是通过使用 Drawer variant="persistent" 来实现的。
但是文本内容不会左右移动,它始终保持固定。我想让它移动,如屏幕截图所示。
代码如下:
import React, { Component } from 'react';
import PropTypes from 'prop-types';
//NB: I'm using material-ui core/v3.9.3, and icons/v3.0.2
import AppBar from '@material-ui/core/AppBar';
import Drawer from '@material-ui/core/Drawer';
import MenuItem from '@material-ui/core/MenuItem';
import Toolbar from '@material-ui/core/Toolbar';
import IconButton from '@material-ui/core/IconButton';
import Typography from '@material-ui/core/Typography';
import Button from '@material-ui/core/Button';
import MenuIcon from '@material-ui/icons/Menu';
import { withStyles } from '@material-ui/core/styles';
import CssBaseline from '@material-ui/core/CssBaseline';
import { BrowserRouter, Route, Link } from 'react-router-dom'; …Run Code Online (Sandbox Code Playgroud) 我正在解释发生了什么.
//VERSION: Async
private async void DoWorkAsync()
{
Stopwatch stpWatch = new Stopwatch();
_logger.WriteToLog("Doing some work...etc + ThreadID=" + Thread.CurrentThread.ManagedThreadId);
stpWatch.Start();
await Task.Delay(5000);
stpWatch.Stop();
_logger.WriteToLog("Work finished on ThreadID=" + Thread.CurrentThread.ManagedThreadId + " ElapsedTime:" + stpWatch.ElapsedMilliseconds);
}
Run Code Online (Sandbox Code Playgroud)
称如下:
//loop 10 times
Parallel.For(1, 11, p => DoWorkAsync());
Run Code Online (Sandbox Code Playgroud)
到现在为止还挺好.这些任务会按预期延迟大约5秒.(尽管Parallel.For循环之前完成,正如预期的那样).
但是,如果我写上述方法的同步版本:
//VERSION: Synchronous
private void DoWork()
{
Stopwatch stpWatch = new Stopwatch();
_logger.WriteToLog("Doing some work...etc + ThreadID=" + Thread.CurrentThread.ManagedThreadId);
stpWatch.Start();
Task.Delay(5000);
stpWatch.Stop();
_logger.WriteToLog("Work finished on ThreadID=" + Thread.CurrentThread.ManagedThreadId + " ElapsedTime:" + stpWatch.ElapsedMilliseconds);
} …Run Code Online (Sandbox Code Playgroud) c# multithreading asynchronous .net-4.0 task-parallel-library
reactjs ×2
.net-4.0 ×1
ajax ×1
async-await ×1
asynchronous ×1
c# ×1
calendar ×1
css ×1
ddl ×1
html ×1
jquery-ajax ×1
jqxhr ×1
material-ui ×1
react-router ×1
schema ×1
sql ×1
sql-scripts ×1
sql-server ×1
ssms ×1
tfs2012 ×1
windows ×1
winforms ×1
wpf ×1
xml ×1
xsd ×1