问题描述
我在Windows 10中创建了一个简单的托管Web应用程序。我的网站已启动并运行。但是在开发过程中,当我尝试调用本机Windows功能时,它无法正常工作。甚至不是基本的java脚本:例如警报。
I created a simple hosted web app in windows 10. I have my web site up and running. However in development, when I try to call a native windows feature it is not working. Not even basic java script: alert for example.
在我的网站中,常规java脚本在Edge中工作,但是当我尝试在托管应用程序中查看它时,没有任何作用。我是否必须在应用程序商店发布应用程序才能开发?
In my site regular java script works in Edge, but when I try to view it in the hosted app nothing works. Do I have to publish the app the the app store to be able to work on development?
提前致谢。
推荐答案
这是您的问题 - 您是否确保允许来自您站点的代码访问Windows?
Just in case this is your problem - have you made sure that code from your site is allowed access to Windows?
在Visual Studio中,这涉及到您的应用程序清单(.appxmanifest)文件应用程序和更改内容URI部分。
In Visual Studio, this involves going to the application manifest (.appxmanifest) file for your application and changing the Content URIs section.
一个常见的示例网站是http://contosotravel.azurewebsites.net。为了使它成为一个'应用程序',我将在Visual Studio 2015中创建一个新的HTML / JS应用程序。然后我打开清单文件,然后进行2次更改;
A common example website is http://contosotravel.azurewebsites.net. To make this into an 'app' I would make a new HTML/JS application in Visual Studio 2015. I'd then open the manifest file and I'd make 2 changes;
1 )在"应用程序"选项卡上,我将起始页面更改为http://contosotravel.azurewebsites.net
1) On the 'application' tab I'd change the start page to be http://contosotravel.azurewebsites.net
2)在"内容URI"选项卡上确保列出的URI是为所有WinRT访问"包含"的。
2) On the 'Content URIs' tab I'd make sure that URI was listed for being 'included' for All WinRT access.
我希望这有帮助 - 如果这不是你的问题,请道歉。
I hope that helps - apologies if this turns out to not be your problem here.
谢谢,
Mike
这篇关于[UWP]托管网络应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!