小编Dar*_*Guy的帖子

Windows 10上的iisreset错误

我最近将桌面从Windows 7升级到Windows 10

但是当我从管理员控制台运行iisrest时,我收到以下错误:

重启尝试失败.IIS管理服务或万维网发布服务或依赖于它们的服务无法启动.服务或从属服务在启动期间可能出错或可能被禁用.

我最初检查了我的服务,并且不再有IIS Admin服务.然后,我检查了Windows功能,并且根据网上讨论安装IIS的几乎所有文章,我选择了Internet信息服务.

我已经检查并且Web服务已重新启动,这是Windows10的一项新功能,不再需要IIS Admin服务.是否还需要执行一项安装服务的步骤

或者这现在是IISReset的问题,我可以忽略错误.

我还在新安装的Windows 10机箱上对此进行了测试,运行IISReset会出现同样的错误,并再次通过Windows功能验证安装了IIS

我可以在本地访问网站也没有任何问题

iis iisreset windows-10

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

如何在 OpenAPI 3.0 的组件/示例部分中正确定义示例?

我正在尝试使用 OpenAPI 3、YAML 来构建 API 定义。我一直在使用文档https://swagger.io/docs/specation/adding-examples/了解如何添加示例。

在我的 API 定义中,我有一个返回 JSON 数组的端点。我已经成功地让这个示例作为 API 定义的一部分工作,但现在我试图提取该示例并将其移动到参考资料部分components,但我没有任何运气。

这是我目前拥有的:

paths: 
  /report:
    get:
      parameters: 
        - in: query
          name: dateFrom
          schema:
            type: string
            format: date
          required: true
          example: "2020-01-21"
          description: The start date range
        - in: query
          name: dateTo
          schema:
            type: string
            format: date
          required: true
          example: "2020-02-01"
          description: The end date range
      summary: Used by Anayltics to produce reports showing submission that cannot be determined by GA
      responses:
        '200':
          description: valid response …
Run Code Online (Sandbox Code Playgroud)

openapi

7
推荐指数
1
解决办法
4394
查看次数

尝试在 minikube 中公开 docker 容器时出错

我正在使用 minikube 来学习 docker,但遇到了一个问题。

我正在按照 Kubernetes in Action 中的示例进行操作,并且尝试获取从 docker hub 帐户中提取的 pod,但我无法使该 pod 可见。

如果我跑

kubectl get pod
Run Code Online (Sandbox Code Playgroud)

我可以看到 pod 存在。

NAME    READY   STATUS    RESTARTS   AGE
kubia   1/1     Running   1          6d22h
Run Code Online (Sandbox Code Playgroud)

但是,当我执行第一步创建服务时

kubectl expose rc kubia --type=LoadBalancer --name kubia-http service "kubia-http" exposed
Run Code Online (Sandbox Code Playgroud)

我收到此错误返回

Error from server (NotFound): replicationcontrollers "kubia" not found
Error from server (NotFound): replicationcontrollers "service" not found
Error from server (NotFound): replicationcontrollers "kubia-http" not found
Error from server (NotFound): replicationcontrollers "exposed" not found
Run Code Online (Sandbox Code Playgroud)

有什么想法为什么我会收到此错误以及我需要做什么来纠正它吗?

我在 mac Mojave …

kubernetes minikube

7
推荐指数
1
解决办法
2152
查看次数

如何让Moq验证具有out参数的方法

我有一个接口定义,其中方法定义了out参数

public interface IRestCommunicationService
{
    TResult PerformPost<TResult, TData>(string url, TData dataToSend, out StandardErrorResult errors);
}
Run Code Online (Sandbox Code Playgroud)

我有下面的类正在使用上述接口

    public TripCreateDispatchService(IRestCommunicationAuthService restCommunicationService, ISettings settings)
    {
        _restCommunicationService = restCommunicationService;
        _settings = settings;
    }

    public FlightAlert CreateTrip(string consumerNumber, PostAlertModel tripModel, out StandardErrorResult apiErrors)
    {
        url = .. code ommited
        var result = _restCommunicationService.PerformPost<FlightAlert, PostAlertModel>(url), tripModel, out apiErrors);
        return result;
    }
Run Code Online (Sandbox Code Playgroud)

在我的单元测试中,我试图验证是否调用了RestCommunication对象的PerformPost方法。

但是无论我做什么,我都无法让Moq验证该方法是否已被调用

    public void DispatchService_PerformPost()
    {
        var consumerNumber = ...
        var trip = ...
        var result = ...
        var apiErrors = new StandardErrorResult();
        ... code …
Run Code Online (Sandbox Code Playgroud)

c# nunit unit-testing moq

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

限制sitecore发布

我试图在我的Sitecore实例中设置一些限制,以便只有在网站子部分中创建项目的权限的用户也具有发布权限,但只能发布他们具有创建内容权限的项目.

例如,我的内容类似于以下内容:

Sitecore
|- Content
    |- Home
        | - WhatWeDo
            | - Infrastructure
            | - Training
        | - Locations
            | - Europe
            | - North America
Run Code Online (Sandbox Code Playgroud)

我已将Everyone角色设置为对内容树中的所有项具有读取权限,并且我已明确指定拒绝写入,重命名,创建和删除权限

我已经设置了一个角色,"WhatWeDo",并被授予对WhatWeDo及其后代项目的写入,重命名,创建和删除权限.

现在,如果我将"WhatWeDo"角色添加到客户端发布角色,那么被授予"WhatWeDo"角色的用户也可以发布,但他们可以在内容树中发布任何项目.即显示"发布"功能区上的"发布"按钮.

大多数情况下,当我尝试使用谷歌搜索时,他们正在讨论发布限制.即发布设置对话框,但在这种情况下,这对我没用.

我找到了这个/sf/answers/444615461/,但我似乎无法让这个工作,我怀疑它与Sitecore的旧版本有关,不再适用.

我还更新了我的配置,以便只有具有读写权限才能发布发布

  <setting name="Publishing.CheckSecurity" > 
    <patch:attribute name="value" value="true" />
  </setting>    
Run Code Online (Sandbox Code Playgroud)

但这对限制用户发布不应该发布的内容树项目没有影响,因为用户仍然可以在内容树的"位置"部分中发布项目.即,"发布"功能区上仍显示"发布"按钮.

我需要对此进行限制,以便那些被授予"WhatWeDo"角色的用户只能发布项目WhatWeDo及其后代,并且无法在内容树中发布任何其他项目.即,当它们位于WhatWeDo项目或其任何后代时,它们应该只有发布按钮可见.

更新

更新了问题,使我更清楚,我想确保在功能区栏上看不到发布按钮.

security publishing sitecore sitecore7.2

4
推荐指数
1
解决办法
1178
查看次数

如何让gulp-jshint忽略文件夹

我在继承的解决方案中有以下文件夹结构

.\gulp.config.js
.\gulpfile.js
.\.jscsrc
.\.jshintrc
.\default.js
.\Resources\js\main.js
.\Resources\js\modules\   various user created js files
.\Resources\js\vendor\    various js files i.e jQuery
Run Code Online (Sandbox Code Playgroud)

我已经安装了gulp-jscs和gulp-jshint.

.jscsrc我来自https://github.com/johnpapa/pluralsight-gulp/blob/master/.jscsrc.

我在gulpfile.js中有以下内容:

'use strict'

var gulp = require('gulp');
var jshint = require('gulp-jshint');
var jscs = require('gulp-jscs');

gulp.task('verifyJS',function(){
    gulp.src([
        './Resources/**/*.js',
        './*.js'
    ])
    .pipe(jscs())
    .pipe(jshint())
    .pipe(jshint.reporter('jshint-stylish', { verbose: true }));
});
Run Code Online (Sandbox Code Playgroud)

我正在尝试更新.jscsrc中的excludeFiles以排除以下内容:

.\default.js 
.\resources\js\vendor
Run Code Online (Sandbox Code Playgroud)

这是我尝试过的:

 "excludeFiles": [
     "node_modules/**",
     "bower_components/**",
     "Resources/js/vendor/**", // vendor supplied files. ie jQuery
     "./Resources/js/vendor/**", 
     "default.js", 
     "/default.js", 
     "./default.js", 
 ],
Run Code Online (Sandbox Code Playgroud)

我已经包含了我尝试过的所有组合.

但是当我运行gulp verifyJS它时仍然包括我想要排除的文件.

如何正确设置excludeFiles 以排除项目根目录下的文件以及包含所有后续文件和文件夹的子文件夹?

jshint gulp jscs gulp-jscs gulp-jshint

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

WebApi HelpPage HttpResponseMessage SetActualResponseType

我正在使用MVC4项目中的WebApi帮助页面.

根据以下链接,http://blogs.msdn.com/b/yaohuang1/archive/2012/10/13/asp-net-web-api-help-page-part-2-providing-custom-samples- on-the-help-page.aspx我一直在设置HelpPageConfig来设置实际的响应类型.

我有一个控制器,它有两个get方法

/// <summary>
/// Get the list of plans for a specified portfolio
/// </summary>
/// <param name="portfolioIdentifier">Portfolio Identifier (guid)</param>
/// <returns>
/// Returns a list of <see cref="RestDTOs.Plan"/> Plan objects
/// </returns>
    public HttpResponseMessage Get(Guid portfolioIdentifier)
    {
    }

/// <summary>
/// Get full plan details.
/// </summary>
/// <param name="planIdentifier">Plan Identifier (guid)</param>
/// <returns>
/// Returns the <see cref="RestDTOs.Plan"/> Plan object
/// </returns>
[HttpGet]
    public HttpResponseMessage Detail(Guid planIdentifier)
    {
    }
Run Code Online (Sandbox Code Playgroud)

在HelpPageConfig.cs中,我添加了以下内容以尝试设置ResponseBody格式示例

config.SetActualResponseType(typeof(Plan), "Plan", "GET"); …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc-4 asp.net-web-api

0
推荐指数
1
解决办法
1401
查看次数