如何解决从计算机检索数据到网站的最有效方法 | C#
如果问题简单或难以理解,请见谅!
我正在创建一个基于许可证的网站(NodeJS (TypeScript) + React),现在我需要检查是否有来自用户计算机的许可证文件。
我在 Google 上进行了大量搜索并找到了 WCF。我创建了一个本地主机,如下所示。
[ServiceContract]
public interface IService
{
[OperationContract]
[WebInvoke(UriTemplate = "get/mac",ResponseFormat = WebMessageFormat.Json)]
string PostMacAddress(MachineMac data);
}
public class MachineMac
{
public string MacineMacAddress { get; set; }
}
和主机配置:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
<bindings>
<!--<wsHttpBinding>-->
<basicHttpBinding>
<binding name="basicHttp" openTimeout="00:10:00" closeTimeout="00:10:00" sendTimeout="00:10:00" receiveTimeout="01:00:00" maxBufferPoolSize="2147483647">
<security mode="None">
<!--<transport clientCredentialType="None" />-->
</security>
<!--<reliableSession enabled="true" />-->
</binding>
</basicHttpBinding>
<!--</wsHttpBinding>-->
<webHttpBinding>
<binding name="webHttp" openTimeout="00:10:00" closeTimeout="00:10:00" sendTimeout="00:10:00" receiveTimeout="01:00:00" maxBufferPoolSize="2147483647">
<security mode="None">
<!--<transport clientCredentialType="None" />-->
</security>
</binding>
</webHttpBinding>
</bindings>
<services>
<service name="App.Services.Service">
<endpoint address ="rest" binding="webHttpBinding" bindingConfiguration="webHttp" contract="App.Services.IService" behaviorConfiguration="web"></endpoint>
<host>
<baseAddresses>
<add baseAddress="http://localhost:3366" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="mexBehaviour">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<!-- rest api-->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
程序现在正在运行并发送用户的 mac 地址。
如果我从真实服务器向 localhost 发送请求 (ReactJS),它不起作用。当它在我的电脑上时,它只向我通过浏览器创建的主机发送请求。 我的 ReactJS(Axios 请求如下): ReactJS Request 我得到以下错误! My Error as below
我的问题是,还有哪些其他方法可以通过浏览器从用户的计算机中检索信息?或者可以按照我的方式来做吗?上面我创建的示例仅用于验证。我需要知道用户的计算机是否有我需要的文件。假设我需要能够从 C:\\MyAppLicense
目录中进行检查。
谢谢!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。