我试图在Windows 10上安装SQL Server 2017 Express并且它失败了.
以下是失败后的详细信息:
Action required:
Use the following information to resolve the error, and then try the setup process again.
Feature failure reason:
An error occurred for a dependency of the feature causing the setup process for the feature to fail.
Error details:
§ Error installing Microsoft Visual C++ 2015 Redistributable
VS Shell installation has failed with exit code 1638.
Error code: 1638
Log file: C:\Program Files\Microsoft SQL Server\140\Setup Bootstrap\Log\20171018_083459\VCRuntime140_x64_Cpu64_1.log
Visithttps://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=14.0.1000.169&EvtType=VCRuntime140_x64%40Install%400x1638 to get help on troubleshooting.
Run Code Online (Sandbox Code Playgroud)
我是Windows …
我在我的ASP.Net MVC Core项目中安装了Swagger,它正在精美地记录我的API.
我的同事让我在一个完整的框架4.6.1项目中安装它,所以我做了以下工作.
在Package Console Manager中运行:
Install-Package Swashbuckle
Run Code Online (Sandbox Code Playgroud)
要使Test Web API控制器正常工作:1)在WebApi.config中注释掉它:
// config.SuppressDefaultHostAuthentication();
// config.Filters.Add(new HostAuthenticationFilter(OAuthDefaults.AuthenticationType));
Run Code Online (Sandbox Code Playgroud)
现在这个URL: http:// localhost:33515/api/Test 带回XML:
<ArrayOfstring xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<string>value1</string>
<string>value2</string>
</ArrayOfstring>
Run Code Online (Sandbox Code Playgroud)
在Global.asax Register()中,我调用:
SwaggerConfig.Register();
Run Code Online (Sandbox Code Playgroud)
在AppStart.Swagger.Config Register()中我放了:
public class SwaggerConfig
{
public static void Register()
{
var thisAssembly = typeof(SwaggerConfig).Assembly;
GlobalConfiguration.Configuration
.EnableSwagger(c =>
{
c.SingleApiVersion("v1.0", "HRSA CHAFS");
c.IncludeXmlComments(GetXmlCommentsPath());
})
.EnableSwaggerUi(c =>
{});
}
private static string GetXmlCommentsPath()
{
var path = String.Format(@"{0}bin\Services.XML", AppDomain.CurrentDomain.BaseDirectory);
return path;
}
}
Run Code Online (Sandbox Code Playgroud)
现在我收到这个错误:"路由集合中已经有一条名为'swagger_docsswagger/docs/{apiVersion}'的路由.路由名称必须是唯一的."
我已经坚持了几个小时.你怎么摆脱这个?
我有一个通用的存储库,我已经在我的WEB API控制器中实例化了一段时间没有问题.
这是我的控制器看起来像:
[Route("api/[controller]")]
public class EmployeesController : Controller
{
private IGenericRepository<Employee> _empRepo;
public EmployeesController(IGenericRepository<Employee> employeeRepo)
{
_empRepo = employeeRepo;
}
// GET: api/employees
[HttpGet]
public async Task<IEnumerable<Employee>> GetEmployeesAsync(
string firstName = null, string lastName = null)
{
//return await _empRepo.GetAll().Include("Organization").Include("PayPlan").Include("GradeRank").Include("PositionTitle").Include("Series").Include("BargainingUnit")
// .Where(e => (string.IsNullOrEmpty(firstName) || e.FirstName.Contains(firstName))
// && (string.IsNullOrEmpty(lastName) || e.LastName.Contains(lastName))
// )
// .ToListAsync();
return await _empRepo.GetAllIncluding(
a => a.Organization,
b => b.PayPlan,
c => c.GradeRank,
d => d.PositionTitle,
e => e.Series,
f => f.BargainingUnit)
.Where(e => (string.IsNullOrEmpty(firstName) …Run Code Online (Sandbox Code Playgroud) 我的标题中有一个非常简单的局部视图叫做AccountInfoPanel.它只有一行:
Welcome: @HttpContext.Current.User.Identity.Name
Run Code Online (Sandbox Code Playgroud)
在我的Web.Config我有
<authentication mode="Windows" />
Run Code Online (Sandbox Code Playgroud)
但身份名称始终为空.如果我通过VS 2012调试,并打破索引操作,我看到它是空的.
如果我通过启用Windows身份验证和匿名身份验证的IIS运行它,我会遇到挑战.所以我尝试插入我的帐户或test1和test2帐户.它回来说:
HTTP错误401.1 - 未经授权您无权使用您提供的凭据查看此目录或页面.
我也尝试将Impersonation设置为true并从挑战中获得相同的响应.有谁知道如何设置它?
如果所有设置都必须在IIS中完成,那么如何在Visual Studio中调试代码?
另一个问题.我的老板似乎认为你甚至不需要登录框.IE会知道你是谁.并且您可以使用其他帐户在IE中"运行".
我只是找不到任何我喜欢的答案。
我想做这样的事情:
public class TestSqlInjectionController : ApiController
{
public IEnumerable<TestSqlInjectionUser> Get([ValidateSqlInjection]string usernameFilter = null)
{
Run Code Online (Sandbox Code Playgroud)
where[ValidateSqlInjection]查找基础知识,例如如果传入过滤器包含;、--、DROP或 则抛出错误DELETE。
所以我会有一个可维护的列表。
然后创建自定义属性:
[FilterField1ValidateSqlInjection]
Run Code Online (Sandbox Code Playgroud)
这里可能会将逗号分隔的列表拆分为数组。
然后滚动数组并确保每个元素与枚举中的值之一匹配。
这听起来像是在朝着正确的方向前进吗?
问题是我们必须使用动态 SQL 来进行大量的分页、排序和过滤。没有其他办法了。
所以命令参数并没有真正为我们做很多事情。
对于任何有 .Net SQL 注入经验的人来说,自定义属性听起来是个好主意吗?
我已经阅读了SpecFlow的入门教程.一切正常,除了我有@SpecRun测试,因为我还没有输入演示密钥.
但在我们的主项目中,我们使用NUnit而不是SpecFlow + Runner.所以我试图模仿那个项目.如果您使用NUnit,则不需要演示密钥.所以我将单元测试提供程序更改为:
<specFlow>
<unitTestProvider name="NUnit" />
</specFlow>
Run Code Online (Sandbox Code Playgroud)
我还将我的教程参考文献与主项目的参考文献进行了比较.我发现我可以拿出TechTalk.SpecRun,该项目仍然可以编译.当然需要TechTalk.SpecFlow.
如果我取出SpecRun.SpecFlowPlugin,除了@SpecRun之外没有测试显示,这是没有demo键的测试延迟.
我还在主项目中看到一个名为:SpecFlowNUnitExtension.cs的csharp文件.我带来了这个文件,但我的测试仍未显示在Visual Studio测试窗口中.注册此文件需要做些什么吗?
我如何摆脱每个模型错误的子弹。有风格属性吗?我没有看到一个智能。
我安装了节点版本 6.11.3。我需要在 Windows 上安装 8.11.3。我只是找不到任何有效的东西。有谁知道如何做到这一点?
我有一个函数,它的集合SearchCriteria对象:列名或关键,运营商(<,<=,like等),和价值.
该函数构建一个命令对象.我将值设为命令参数,现在我的单元测试不适用于日期.但我的所有单元测试都适用于所有其他数据类型,如varchar.
在调试器中,我的一个日期单元测试失败,最终看起来像这样:
SELECT * FROM (SELECT DocumentId
FROM idx1_AuthLetters a
INNER JOIN Documents b ON a.DocumentId = b.Id
WHERE Status in ('L','S','V') AND letter_date <= :1
ORDER BY DOCUMENTID )
WHERE RowNum <= 14
Run Code Online (Sandbox Code Playgroud)
我确实有一个名为like:letter_date的参数.但我可能有:letter_date> = ### &&:letter_date <= ###我在两个日期之间寻找.我不能两次使用相同的参数名称,因此当我循环遍历所有的SearchCriteria对象时,我使用i ++计数器作为参数名称.很奇怪看到一个名为这样的参数我知道,但它在大多数情况下都有效.
如果我接受并放入我的查询窗口,并查看param值并将其插入:
SELECT * FROM (SELECT DocumentId
FROM idx1_AuthLetters a
INNER JOIN Documents b ON a.DocumentId = b.Id
WHERE Status in ('L','S','V') AND
letter_date <= TO_DATE('2013-1-21', 'yyyy-mm-dd')
ORDER BY DOCUMENTID ) …Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的项目中设置ASP.Net Identity Core.问题是我们将使用Windows身份验证而不是表单身份验证.通过在iisSettings的launch.settings中设置这些属性,我可以让Authorize标签在home控制器上工作:
"windowsAuthentication": true,
"anonymousAuthentication": false,
Run Code Online (Sandbox Code Playgroud)
所以现在在我的标题中,我通过我的布局文件看到我的用户名:
@User.Identity.Name
Run Code Online (Sandbox Code Playgroud)
所以我在标题右上角的用户名如下所示:
[domain\username\]
Run Code Online (Sandbox Code Playgroud)
所以现在授权标签工作.如果我关闭Windows身份验证并返回匿名身份验证,我将获得该页面的未授权状态.如果回到Windows身份验证,我可以再次看到主页/索引页面.尚未与身份有多大关系.
现在我尝试创建一个创建用户页面,最终真正成为Active Directory页面的"添加用户".所以我试图以这种格式存储UserName:
domain\username
Run Code Online (Sandbox Code Playgroud)
这是我的创建代码:
[HttpPost]
public async Task<IActionResult> CreateUser(CreateUserViewModel createUserModel)
{
if (ModelState.IsValid)
{
AppUser user = new AppUser
{
UserName = createUserModel.Name,
Email = createUserModel.Email
};
IdentityResult result
= await _userManager.CreateAsync(user, createUserModel.Password);
if (result.Succeeded)
{
return RedirectToAction("Index");
}
else
{
foreach (IdentityError error in result.Errors)
{
ModelState.AddModelError("", error.Description);
}
}
}
return View(createUserModel);
}
Run Code Online (Sandbox Code Playgroud)
但是我收到了这条消息:
User name 'domain\username' is invalid, can only contain letters or digits.
Run Code Online (Sandbox Code Playgroud)
所以通过阅读我一直看到你可以使用UserManager的这些属性来处理这个: …
c# ×3
.net ×2
asp.net ×2
asp.net-core ×2
installation ×1
node.js ×1
oracle ×1
specflow ×1
sql-server ×1
swagger ×1
swashbuckle ×1
upgrade ×1
validation ×1