我正在遵循本指南:
但是使用模拟器,而不是使用实际的 Azure 帐户。
我应该在这一行中使用什么?
$storageClient = new Microsoft_WindowsAzure_Storage_Blob('blob.core.windows.net',
'Your_Storage_Account_Name',
'Your_Primary_Access_Key');
Run Code Online (Sandbox Code Playgroud) 我试图有条件地阻止访问路由.我认为这可以用guardRoute完成:http://durandaljs.com/documentation/Router/
function guardRoute(routeInfo, params, instance) : object- 在激活任何路由之前,调用guardRoute函数.您可以插入此功能以添加自定义逻辑,以根据请求的路径允许,拒绝或重定向.允许,返回true.否认,返回false.要重定向,请返回带有散列或URL的字符串.您也可以返回任何这些值的承诺.
我不知道如何指定应该访问哪条路径,或者如果我需要拒绝访问,如何重新路由到另一个视图.有人可以用这种方式发布它的使用示例吗?
我认为RESTful搜索的标准方法是这样的:
GET /users?parameter1=value1¶meter2=value2¶meter3=value3¶meter4=value4
Run Code Online (Sandbox Code Playgroud)
但我想做这样的事情:
GET /users
# Request body:
{
"parameter1": "value1",
"parameter2": "value2",
"parameter3": "value3",
"parameter4": "value4"
}
Run Code Online (Sandbox Code Playgroud)
更新:我不能以上述方式使用GET,因为有些设备不尊重GET请求的正文内容.所以我不得不使用POST.
RESTful宗教信仰是我不应该使用POST将JSON数据发送到/api/search端点的唯一原因,而不是使用URI吗?
以这种方式使用POST是否有任何技术上和可证明的危险?
我知道这与以下内容类似:
但我要问更具体的事情:即,除了"它不符合惯例"之外,这是一个坏方法的原因是什么.
我正在尝试将数据从一个数据库表插入到Azure SQL中的另一个数据库表(在同一服务器上).我看到以下内容:
https://azure.microsoft.com/en-us/blog/querying-remote-databases-in-azure-sql-db/
这描述了我应该能够做到以下几点:
CREATE EXTERNAL DATA SOURCE RemoteReferenceData
WITH
(
TYPE=RDBMS,
LOCATION='myserver.database.windows.net',
DATABASE_NAME='_2016-09-07-17412',
CREDENTIAL= SqlUser
);
CREATE EXTERNAL TABLE [dbo].[RemotePhotos](
[PhotoId] int NOT NULL,
[Url] nvarchar(max) NULL,
)
WITH
(
DATA_SOURCE = RemoteReferenceData
);
Run Code Online (Sandbox Code Playgroud)
但是当我运行时,我得到以下内容:
找不到指定的凭据.
如何为此目的创建凭据?有没有更好的方法来解决这个问题?
我有以下内容:
public override Task OnConnected() {
HandleConnectionAsync(Context).Wait();
return base.OnConnected();
}
Run Code Online (Sandbox Code Playgroud)
在遵循“不阻止集线器方法”的指导时,我试图等待我的HandleConnectionAsync呼叫,但如果我使用async,我最终会得到以下结果:
public override async Task OnConnected() {
await HandleConnectionAsync(Context);
await base.OnConnected();
}
Run Code Online (Sandbox Code Playgroud)
但我不会返回任何东西。这样做的正确方法是什么?
我有以下代码:
public async Task SendPushNotificationAsync(string username, string message)
{
var task = ApnsNotifications.Instance.Hub.SendAppleNativeNotificationAsync(alert, username);
if (await Task.WhenAny(task, Task.Delay(500)) == task) {
return true;
}
return false;
}
Run Code Online (Sandbox Code Playgroud)
我注意到它SendAppleNativeNotificationAsync是无限期挂起的(永远不会从包含方法返回),所以我试着告诉它在500ms后取消.但是仍然......对WhenAny现在的调用挂起并且我从未看到过return命中,导致消费者无限期地等待(这是调用此异步方法的同步方法,所以我调用.Wait()):
_commService.SendPushNotificationAsync(user.Username, notificationDto.PushContent).Wait(TimeSpan.FromSeconds(1));
Run Code Online (Sandbox Code Playgroud)
如何在一定时间后强制完成此操作,无论如何?
如果我只是"发射并忘记"而不是await执行任务会发生什么?
.net c# apple-push-notifications async-await azure-notificationhub
我已经看到了settings.job有关此操作的一些指导,但是它不起作用-在控制台中,我看到了:
WebJob singleton setting is False
Run Code Online (Sandbox Code Playgroud)
如何防止横向扩展运行Webjob的多个实例?
我有以下内容:
public class StripeController : Controller
{
private readonly UserService _userService;
public StripeController(UserService userService)
{
_userService = userService;
}
[HttpPost]
public ActionResult StripeWebook()
{
return new HttpStatusCodeResult(HttpStatusCode.OK);
}
[HttpPost]
[Route("api/stripewebhook")]
public async Task<ActionResult> Index(CancellationToken ct)
{
var json = new StreamReader(Request.InputStream).ReadToEnd();
var stripeEvent = StripeEventUtility.ParseEvent(json);
switch (stripeEvent.Type)
{
case StripeEvents.ChargeRefunded: // all of the types available are listed in StripeEvents
var stripeCharge = Stripe.Mapper<StripeCharge>.MapFromJson(stripeEvent.Data.Object.ToString());
break;
}
return new HttpStatusCodeResult(HttpStatusCode.OK);
}
}
Run Code Online (Sandbox Code Playgroud)
来自 stripe 的请求会生成错误:
路径“/api/stripewebhook”的控制器未找到或未实现 IController
知道当我从条带门户进行测试时为什么会发生这种情况吗?
我在这里关注这个例子:https://www.w3.org/TR/webrtc/#simple-peer-to-peer-example
我修改了代码,因为我只需要单向流:
var configuration = null; //{ "iceServers": [{ "urls": "stuns:stun.example.org" }] };
var peerConnection;
var outboundPeerStream = null;
var outboundPeerStreamSessionId = null;
var createPeerConnection = function () {
if (peerConnection)
return;
peerConnection = new RTCPeerConnection(configuration);
// send any ice candidates to the other peer
peerConnection.onicecandidate = function (event) {
signalrModule.sendClientNotification(JSON.stringify({ "candidate": event.candidate }));
};
// let the "negotiationneeded" event trigger offer generation
peerConnection.onnegotiationneeded = peerStreamingModule.sendOfferToPeers;
// once remote track arrives, show it in the remote video …Run Code Online (Sandbox Code Playgroud) 假设我们有以下内容:
Peer1 加入,创建 RTCPeerConnectionAPeer2 加入,创建 RTCPeerConnectionBSDP/ICE握手发生,连接建立,流媒体发生
4A。Peer2失去连接并重新加入
4B。Peer2刷新浏览器
Peer1在4A和应该做什么4B?
同4A一个RTCPeerConnection对象可供对等方使用 - 是否需要完成任何工作才能完全修复连接?
在4B,Peer1保持了连接的一端但Peer2从头开始。可以Peer1重用ICE候选对象并localDescription修复与RTCPeerConnection另一端新对象的连接,还是还需要创建一个全新的实例RTCPeerConnection并重新启动握手、候选对象等?
.net ×3
c# ×3
azure ×2
webrtc ×2
asp.net ×1
asp.net-mvc ×1
async-await ×1
asynchronous ×1
durandal ×1
json ×1
php ×1
rest ×1
signalr ×1
sql ×1
sql-server ×1