我正在尝试将视频从https网站播放到我的媒体元素中,抛出以下异常.
PresentationCore.dll中出现"System.NullReferenceException"类型的异常,但未在用户代码中处理
附加信息:未将对象引用设置为对象的实例.
这是我在xmal中的代码
<MediaElement x:Name="mediaElement" LoadedBehavior="Manual" Stretch="Fill" Loaded="OnMediaElementLoaded" MediaOpened="MediaElement_OnMediaOpened" />
var uri = new Uri("https://f60b7719060a37f20253-4343910d3bf76239b8a83e4f56d17dc5.ssl.cf2.rackcdn.com/mov-2015-06-07-22-08-09-391574e61009867cfcb1a1641639b39e55c8a34c.mp4", UriKind.RelativeOrAbsolute);
mediaElement.Source = uri;
mediaElement.Play();//Getting exception here.
Run Code Online (Sandbox Code Playgroud)
有什么帮助吗?我也尝试使用其他一些http.
我试图从我的MVC控制器,抛出异常,序列化错误或使用JSON JavaScriptSerializer反序列化发送json.字符串的长度超过maxJsonLength属性上设置的值.
我用谷歌搜索并在我的配置中添加了最大长度,也覆盖了我的json方法,没有任何工作.
这是我的web配置和我的方法,它抛出异常.在appsetting
<add key="aspnet:MaxJsonDeserializerMembers" value="2147483647" />
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="2147483647">
</jsonSerialization>
</scripting>
</system.web.extensions>
Run Code Online (Sandbox Code Playgroud)
过度的方法
protected override JsonResult Json(object data, string contentType, System.Text.Encoding contentEncoding, JsonRequestBehavior behavior)
{
return new JsonResult()
{
Data = data,
ContentType = contentType,
ContentEncoding = contentEncoding,
JsonRequestBehavior = behavior,
MaxJsonLength = Int32.MaxValue
};
}
Run Code Online (Sandbox Code Playgroud)
我的方法
public JsonResult GetAttributeControls()
{
List<SelectListItem> attrControls;
using (var context = new Context())
{
attrControls = context.AttributeControls.ToList().
Select(ac => new SelectListItem { Text = ac.Name, Value = ac.AttributeControlId.ToString() }).ToList();
} …Run Code Online (Sandbox Code Playgroud) 在尝试运行我在IIS中托管的应用程序时,它会给我以下错误.
Module IIS Web Core
Notification BeginRequest
Handler Not yet determined
Error Code 0x80070021
Config Error This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".
Config File \\?\C:\inetpub\wwwroot\Planner\web.config
Run Code Online (Sandbox Code Playgroud)
谷歌搜索后我发现了一些建议,我试图在命令提示符下运行以下注释它已解锁.
%windir%\ system32\inetsrv\appcmd.exe解锁config -section:system.webServer/handlers -commitpath:apphost
现在我收到以下新错误.
Module IIS Web Core
Notification ExecuteRequestHandler
Handler BlockViewHandler
Error Code 0x8007000d
Requested URL http://localhost:80/Planner/Views
Physical Path …Run Code Online (Sandbox Code Playgroud)