我正在制作一个基本的jquery游乐场网站.我收到错误:net::ERR_CONTENT_LENGTH_MISMATCH正在页面加载时发生,并且页面上没有加载背景图像.
有问题的图像是300kb,也是动态变化的.我假设这与文件大小有关,但我真的不知道是什么.
最初使用的HTML:
<p style="margin:0px; padding:0px;">
<img id="background" src="/bg1.jpg" style='width:100%;' border="0" alt="Null">
</p>
Run Code Online (Sandbox Code Playgroud)
用于更改背景的javascript/jquery:
var changebg = function() {
if (myscore % 20 == 0) {
level++;
document.getElementById("level").innerHTML = "Level: " + level;
$("#level").fadeIn(1500, function(){$("#level").hide()})
backgroundindex++;
if (backgroundindex > 6) {
backgroundindex == Math.floor((Math.random()*6)+1)};
document.getElementById("background").src="/bg"+backgroundindex+".jpg";
};
}
Run Code Online (Sandbox Code Playgroud) 我的Windows服务与MVC项目处于同一解决方案中.
MVC项目使用SignalR Client的引用,它需要Newtonsoft.Json v6 +
Windows服务使用System.Net.Http.Formatting,这需要Newtonsoft.Json版本4.5.0.0.
我认为这不会是一个问题,因为我可以在我的App.Config中使用绑定重定向,但是我得到一个错误
System.Net.Http.Formatting.dll中发生未处理的"System.IO.FileLoadException"类型异常
附加信息:无法加载文件或程序集'Newtonsoft.Json,Version = 4.5.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed'或其依赖项之一.定位的程序集的清单定义与程序集引用不匹配.(HRESULT异常:0x80131040)
我的app.config有以下内容:
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
</dependentAssembly>
Run Code Online (Sandbox Code Playgroud)
我自己添加了它,它不起作用,我也尝试使用nuget包管理器卸载并重新安装Json.Net,但无济于事
我正在尝试将一些表从实时数据库移动到另一个数据库,然后在传输数据后将其生效.第二个数据库存在于2008年的服务器上,迁移是从2012年开始的,这导致了一些问题
最初我用Scripts做了一个完整的数据库导出.因为导出工具不会转到以前的版本. - 完全导出后,我删除了db2上多余的表.因为我只在约200个左右移动40个左右.
现在DB结构已经建立,一切正常.与过时的数据.一旦数据更新,一切都准备好了.所以我理想地喜欢一个脚本,它检查db2中是否存在db1中的表,然后是否复制所有行.这可能吗?
我正在使用内存流将System.Drawing.Bitmap编写到Azure存储.我有正确的凭据和一切蔚蓝的一面正确连线.我已经使用输入流成功地将图像上传到blob中,所以我认为这对于我如何使用memorystream对象一定是个问题.
看了一会儿后,我的问题的一般解决方案看起来是将内存流位置设置为0,但这对我没有用,而且一个空文件仍然保存到azure中.
我的代码是:
using (image)
{
System.IO.MemoryStream ms = new MemoryStream();
//create an encoder parameter for the image quality
EncoderParameter qualityParam = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, quality);
//get the jpeg codec
ImageCodecInfo imgCodec = ImageUtilities.GetEncoderInfo(CodecInfo);
//create a collection of all parameters that we will pass to the encoder
EncoderParameters encoderParams = new EncoderParameters(1);
//set the quality parameter for the codec
encoderParams.Param[0] = qualityParam;
//Move the pointer to the start of stream.
ms.Position = 0;
image.Save(ms, imgCodec, encoderParams);
blockBlob.UploadFromStream(ms);
}
Run Code Online (Sandbox Code Playgroud)
最后保存的图像元素中包含数据.在调试时保持正确的长度等,所以问题出现在上传步骤中
asp.net ×2
c# ×2
asp.net-mvc ×1
azure ×1
html ×1
javascript ×1
jquery ×1
json.net ×1
powershell ×1
sql ×1
sql-server ×1
t-sql ×1