小编Chr*_*ris的帖子

ServiceStack Web服务安全性

嗨,我刚接触Servicestack并下载了他们非常全面的bootstrapapi示例并正在使用它,但我仍然遇到了一些问题.问题在于安全性,发生的事情是我在尝试访问受保护的服务时遇到405错误.使用身份验证服务,似乎我正在进行身份验证.请帮忙解释一下.这是代码:

public class Hello
{
    public string Name { get; set; }
}

public class AuthHello
{
    public string Name { get; set; }
}

public class RoleHello
{
    public string Name { get; set; }
}
public class HelloResponse
{
    public string Result { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

服务:

public class HelloService : ServiceBase<Hello> 
{
    //Get's called by all HTTP Verbs (GET,POST,PUT,DELETE,etc) and endpoints JSON,XMl,JSV,etc
    protected override object Run(Hello request)
    {
        return new HelloResponse { Result = "Hello, Olle …
Run Code Online (Sandbox Code Playgroud)

security web-services servicestack

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

MVC3控制器返回JsonFile

我遇到了json结果的问题.从jquery调用时,它返回一个要保存的文件,而不是执行success函数.get jquery请求发生在document.ready函数中.

任何帮助,将不胜感激.

public ActionResult Locations()
    {
        LocationsModel lm = new LocationsModel();
        return Json(lm.getPins(), JsonRequestBehavior.AllowGet);
    }
Run Code Online (Sandbox Code Playgroud)

我也尝试过:

public JsonResult Locations()
    {
        LocationsModel lm = new LocationsModel();
        return Json(lm.getPins(), JsonRequestBehavior.AllowGet);
    }
Run Code Online (Sandbox Code Playgroud)

jquery如下:

$.ajax({
        type: "POST",
        contentType: "application/json; charset=utf-8",
        url: this.href,
        data: "{}",
        dataType: "json",
        success: function (msg) { getPins_success(msg); },
        error: OnError
    });
Run Code Online (Sandbox Code Playgroud)

谢谢,克里斯

编辑:

没关系,这是一个骗局.一旦我将json请求移动到控制器中的另一个动作并加载了视图,它就完成了.现在我正在解决问题,但这是另一个问题.

jquery asp.net-mvc-3

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

documentdb 模拟器网关服务在启动时崩溃

我正在寻找了解 documentdb 并安装模拟器似乎没有错误。但是,在启动时我有一个服务崩溃:

网关服务启动

从标题来看,我猜这是对模拟器的一项重要服务。有趣的是,模拟器似乎继​​续加载并尝试打开: https://localhost:8081/_explorer/index.html

没有成功。

使用命令提示符我尝试手动启动网关服务,结果如下:

C:\Program Files\DocumentDB Emulator\Packages\GatewayService\GatewayService.Code>documentdb.gatewayservice.exe /?

未处理的异常:System.Runtime.InteropServices.COMException:注册表的值无效(来自 HRESULT 的异常:0x80040153 (REGDB_E_INVALIDVALUE))在 System.Runtime.InteropServices.RuntimeEnvironment.GetDeveloperPath() 在 System.AppDomain.SetupFusionupStore info(AppDomain)InfoSet在 System.AppDomain.SetupDomain(Boolean allowRedirects, String path, String configFile, String[] propertyNames, String[] propertyValues)

C:\Program Files\DocumentDB Emulator\Packages\GatewayService\GatewayService.Code>documentdb.startupentrypoint.exe /?

未处理的异常:System.Runtime.InteropServices.COMException:注册表的值无效(来自 HRESULT 的异常:0x80040153 (REGDB_E_INVALIDVALUE))在 System.Runtime.InteropServices.RuntimeEnvironment.GetDeveloperPath() 在 System.AppDomain.SetupFusionupStore info(AppDomain)InfoSet在 System.AppDomain.SetupDomain(Boolean allowRedirects, String path, String configFile, String[] propertyNames, String[] propertyValues)

C:\Program Files\DocumentDB Emulator\Packages\GatewayService\GatewayService.Code>

网关服务是否相关?知道如何解决吗?

快速编辑:我已按照此处列出的说明进行操作:https : //docs.microsoft.com/en-us/azure/documentdb/documentdb-nosql-local-emulator#troubleshooting

没有生成要通过电子邮件发送的 etl 文件。

提前致谢

azure-cosmosdb

5
推荐指数
2
解决办法
2325
查看次数

mvc partial view ajax update将局部视图作为页面返回

我有一个部分的观点,即在向数据库添加项目时需要更新.

Index.cshtml:

@using (Ajax.BeginForm("Index", "WinEntry", new AjaxOptions { HttpMethod = "POST",      UpdateTargetId = "wingrid", InsertionMode = InsertionMode.Replace}))
{
    @Html.Partial("_winVenue")
    @Html.Partial("_singleWin")
}
<div id="wingrid">
    @Html.Partial("_wingrid")
</div>
Run Code Online (Sandbox Code Playgroud)

_singleWin有提交按钮

控制器:

[HttpPost]
public ActionResult Index(Win win)
{
    win.dealerId = "1234567890";
    win.posterid = "chris";
    win.posttime = DateTime.Now;
    wem.addWin(win);
    IEnumerable<Win> w = wem.getVenueWins(win.venue,win.windate);
    return PartialView("_wingrid",w);
}
Run Code Online (Sandbox Code Playgroud)

当控制器返回局部视图_wingrid时,它将其作为新页面返回,我正在寻找的行为就像是wingrid div中的更新面板.

任何帮助,将不胜感激.

ajax partial-views partial-page-refresh asp.net-mvc-3

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

在路径末尾重置简单的 svg 对象

这可能真的很简单,但我开始学习 svg 并且对以下代码的行为感到困惑:

<svg>
<defs>
    <path id="thepath" fill="none" stroke="#000000" d="M25,0 L200,200" />
</defs>
<rect x="25" y="0" width="50" height="100" fill="slategrey">
      <animateTransform id="one"
                        attributeType="xml"
                        attributeName="transform"
                        type="rotate"
                        from="0 50 50"
                        to="360 50 50"
                        dur="1s"
                        repeatCount="indefinite" 
                        end ="onemove.end"/>

    <animateMotion id="onemove" dur="3s">
        <mpath xlink:href="#thepath"/>
    </animateMotion>
</rect>
Run Code Online (Sandbox Code Playgroud)

我期望发生的是矩形在中心点上旋转成圆形。它的作用。

我希望它也能沿着这条路走下去。它的作用。

我希望它在路径上停止旋转。我认为确实如此。

我希望它停留在路径的尽头。它没有。

它重置到起点并停止旋转。所以我不确定是重置停止了旋转还是实际的结束语句停止了旋转。

所以我的问题有两个:为什么它会重置以及我如何防止它。

此外,任何指向良好 svg 教程的链接将不胜感激。虽然我找到了很多教程,但我认为我没有找到质量,因为我觉得这是一个非常简单的问题,我应该已经从我的研究中知道了。

我想我需要一些东西来防止重置,但我不知道是什么。

提前致谢。

svg svg-animate

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

ISNULL(Count(x),0)为null时不返回0

我有以下代码:

SELECT     FirstName, LastName,
(SELECT ISNULL(COUNT(UP1.EmailAddress), 0) AS HasEmail 
     From dbo.UserProfiles AS UP1 
     WHERE (NOT (UP1.EmailAddress IS NULL)) AND (CreatedBy = dbo.UserProfiles.UserID)
     GROUP BY CreatedBy) AS EmailEnteredCount FROM dbo.UserProfiles WHERE (IsStaff = 1)
Run Code Online (Sandbox Code Playgroud)

样本结果:

姓氏EmailEnteredCount

帐单为空

拉尔森51

佳士得30

零值

senac NULL

该代码可以正确执行,但有一个例外,当未找到任何记录而不是预期的0时,它将返回一个空值。

更新:这将返回我要完成的工作,只是需要一个更清洁的解决方案。我真的不认为我需要创建一个临时表来替换一个空值。

drop table #tt
                    select userid,firstname, lastname, 
                    (
                      SELECT     count(*) AS HasEmail
                      FROM         dbo.UserProfiles AS UP1
                      WHERE     (UP1.EmailAddress IS NOT NULL)AND (UP1.CreatedBy = UserProfiles.UserId) and (datecreated between @startdate and @enddate)
                      GROUP BY CreatedBy
                    ) as EmailCount
                    into #tt …
Run Code Online (Sandbox Code Playgroud)

t-sql coalesce isnull

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