我在Azure上创建了一个试用帐户,并从中部署了我的数据库SmarterAsp.
当我运行数据透视查询时SmarterAsp\MyDatabase,结果显示在2秒内.
但是,运行相同的查询Azure\MyDatabase花了94秒.
我使用SQL Server 2014 Management Studio(试用版)连接到服务器并运行查询.
这是速度差异,因为我的帐户是试用帐户吗?
我的问题的一些相关信息
查询是:
ALTER procedure [dbo].[Pivot_Per_Day]
@iyear int,
@imonth int,
@iddepartment int
as
declare @columnName Nvarchar(max) = ''
declare @sql Nvarchar(max) =''
select @columnName += quotename(iDay) + ','
from (
Select day(idate) as iDay
from kpivalues where year(idate)=@iyear and month(idate)=@imonth
group by idate
)x
set @columnName=left(@columnName,len(@columnName)-1)
set @sql ='
Select * from (
select kpiname, target, ivalues, convert(decimal(18,2),day(idate)) as iDay …Run Code Online (Sandbox Code Playgroud) 我有一个新的空MVC 5项目,我尝试安装Nuget包.当我在Nuget控制台中插入命令:Update-Package我得到以下asnwer:
File E:\WebApp\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\tools\uninstall.ps1 cannot be loaded because running scripts is
disabled on this system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.At line:1 char:3
+ & 'E:\WebApp\packages\Microsoft.CodeDom.Providers.Dot ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
Run Code Online (Sandbox Code Playgroud)
然后我开始安装一些新包,并再次收到此消息:
无法加载WebApp\packages\Modernizr.2.8.3\tools\install.ps1,因为在此系统上禁用了运行脚本
我看到了一些与此消息相关的帖子,但与MVC项目无关.
我的问题是:
为什么我收到这些消息?
我该怎么做才能解决这个问题?
此问题可能出现在我的应用程序将运行的服务器上?有些脚本无法按预期运行?
我的网络托管服务提供商不允许我发布exe文件,他告诉我删除它们.
在Web部署期间,我删除了对这3个文件的选择并发布了项目的其余部分.
当发布过程完成并且我尝试访问我的网站时,我收到了csc.exe丢失的错误消息:)
我可以做些什么来不发布exe文件以及我的网站按预期运行吗?
编辑 - 我用MVC5改变了MVC4!
编辑 - 我与我的网络托管服务提供商讨论,他允许我读/写exe文件,现在我的项目正在按预期运行.
我有这个课:
public class BSC
{
public int BSCId { get; set; }
public string BSCName { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
和配置类:
public class BSCConfig :EntityTypeConfiguration<BSC>
{
public BSCConfig()
{
Property(m => m.BSCName).HasMaxLength(50).HasColumnName("Category").IsRequired();
}
}
Run Code Online (Sandbox Code Playgroud)
我想使此属性唯一,但是我没有isUnique或Index方法。
您能告诉我如何使此属性唯一吗?
我知道这个主题已经在几篇文章中进行了讨论,但没有一个解决方案对我有帮助.
我有这个动作:
public ActionResult DownloadViewPDF(string userId)
{
var model = db.MyCvs.FirstOrDefault(u => u.UserId == userId);
if (model != null)
return new Rotativa.ViewAsPdf("ViewUserCv", model) { FileName = model.FirstName + model.LastName + "_CV.pdf" };
return Content("there is no Cv to download");
}
Run Code Online (Sandbox Code Playgroud)
使用上面的操作我正在下载一个视图作为pdf,一切都在我的计算机上按预期工作.
在服务器上部署项目后,此操作无效,返回错误:
在执行当前Web请求期间生成了未处理的异常.可以使用下面的异常堆栈跟踪来识别有关异常的起源和位置的信息.
我正在使用Visual Studio Community 2015.在服务器上,我有Rotativa.dll名为Rotativa的根目录中的文件夹,文件名为wkhtmltopdf.exe.
我不知道如何处理这个错误,你能给我一些消息吗?
我有一个来自 web api 的 Json:
jsonstring ={"users":[{"id":1123,"last_update":"2016-02-28 14:53:04"}],"page":1,"pages":1}
Run Code Online (Sandbox Code Playgroud)
我想在一个对象中反序列化,例如:
public class Rootobject
{
public User[] users { get; set; }
public int page { get; set; }
public int pages { get; set; }
}
public class User
{
public int id { get; set; }
public DateTime last_update { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
为此,我使用:
var obj= JsonConvert.DeserializeObject<Rootobject>(jsonString);
Run Code Online (Sandbox Code Playgroud)
结果null为last_update。
jsonstring是一个字符串结果WebClient.DownloadString(url);看起来像上面的例子。
如何获得反序列化的日期?
编辑:
这篇文章使用 Json.Net 以 dd/mm/yyyy 格式反序列化日期中的任何解决方案都没有帮助我解决我的问题。
我有一个Mvc应用程序,我有这个选项:
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
Run Code Online (Sandbox Code Playgroud)
我不知道这可以做什么,是一个安全设置?
何时选择ComVisible(false)和ComVisible(true)?
我搜索Com组件,了解它是什么,我找到了这个定义:
组件对象模型(COM)是Microsoft在1993年引入的软件组件的二进制接口标准.它用于在大量编程语言中实现进程间通信和动态对象创建.COM是其他几种Microsoft技术和框架的基础,包括OLE,OLE自动化,ActiveX,COM +,DCOM,Windows shell,DirectX,UMDF和Windows运行时.
这对我来说意味着,Com组件是一种在应用程序之间进行通信的方式,但我不确定我对这个定义的理解是否严格.
你能用简单的词语(例子)告诉我,为什么以及何时应该使ComVisible(true)?
我有一个表,我想转换该对象中该表的每一行。该对象将具有每列的属性。
我做了这个功能:
Public Function GetProducts() As Object
Set GetProducts = New Collection
Dim p As New ProductInfo
Dim rng As Range
Dim xRow As Range
Set rng = Sheet2.Range("A2:I" & Sheet2.Range("A2").End(xlDown).Row)
For Each xRow In rng.Rows
p.Id = xRow.Cells(1, 1).Value
p.Cod = xRow.Cells(1, 2).Value
p.Name = xRow.Cells(1, 3).Value
p.productType = xRow.Cells(1, 4).Value
p.norma = xRow.Cells(1, 5).Value
p.masina = xRow.Cells(1, 6).Value
p.masinaType = xRow.Cells(1, 7).Value
p.operatori = xRow.Cells(1, 8).Value
p.sectie = xRow.Cells(1, 9).Value
GetProducts.Add Item:=p, Key:=CStr(p.Id)
Next xRow
End Function
Run Code Online (Sandbox Code Playgroud)
比我尝试用此Sub检查功能: …
我不明白为什么这个查询不起作用,能帮帮我吗?
public static IEnumerable<SelectListItem> MyList(int? id, string name="")
{
var list =db.Entity
.Where(p=>
(name==null? p.Name !=null : p.Name==name) &&
(id.hasValue || p.Id==id)
.Select(n=>new SelectListItem()
{
Text=n.Name,
Value=n.Id.ToString()
}).ToList();
return list;
}
Run Code Online (Sandbox Code Playgroud)
当两个参数都为空时我想要完整的列表!! 但是当两个参数都为空时,我得到一个空列表.
代码段代码来自一个包含多个查询的大方法.