Html+js+powershell build AD Management System for Web Edition (ii)

Source: Internet
Author: User
It has been discovered recently that Gihub's restful webapi has been done and is self-hosted Owin. Much more robust than the last httplistener. It seems to support Job,runspace.
Https://github.com/DimensionDataCBUSydney/PowerShell.REST.API

The process is actually relatively simple, HTML does not change, JS just need to assemble Webapi URL to modify the place, the background of PowerShell Webapi the entire replacement is OK.

Download the source code, directly generated. I used the vs2017. Then you can use it directly, and the only problem is cross-domain.

Initially in the Jquery.ajax with Jsop, but the debug response can see the returned JSON object, but Ajax is not received, it can not be displayed on the page, and Console.log (returned JSON object); There is no responsetext in it.

Most of the online searches are useless.

The front end does not have to change the back end. Mainly do not want to modify their already mature code, afraid there will be problems occur, but no way.
After some research, it is determined that the cross-domain code should be added to the Owin:
1. Installing Microsoft.AspNet.WebApi.Cors
The Startup.cs of 2.dynamicpowershellapi.owin is added using System.Web.Http.Cors;
3.line116 Add a cross-domain configuration config. Enablecors (New Enablecorsattribute ("," "," * "));

And then regenerate it, then, 10 more warnings back again--~, tested, cross-domain problem solved. The page can be displayed normally.

Html+js+powershell build AD Management System for Web Edition (ii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.