C++ 卡萨布兰卡http“U listener”;将url添加到url组时出错;
我目前正试图用卡萨布兰卡实现一个REST接口,但我一直收到“将url添加到url组时出错”。我真的不知道如何解决这个问题。以下是我的主要方法:C++ 卡萨布兰卡http“U listener”;将url添加到url组时出错;,c++,visual-studio,httplistener,casablanca,cpprest-sdk,C++,Visual Studio,Httplistener,Casablanca,Cpprest Sdk,我目前正试图用卡萨布兰卡实现一个REST接口,但我一直收到“将url添加到url组时出错”。我真的不知道如何解决这个问题。以下是我的主要方法: intmain(intargc,char*argv[]) { InterruptHandler::hookSIGINT(); 服务器; setEndpoint(L“http”,41004,L“/api/v1”); 试一试{ //等待服务器初始化。。。 server.accept().wait(); std::wcout好的,我自己就可以解决它了……我必
intmain(intargc,char*argv[])
{
InterruptHandler::hookSIGINT();
服务器;
setEndpoint(L“http”,41004,L“/api/v1”);
试一试{
//等待服务器初始化。。。
server.accept().wait();
std::wcout好的,我自己就可以解决它了……我必须在我的BaseController中对主机使用127.0.0.1。对于Windows,您有另一个需要两个步骤的选项
1) 更改您正在侦听的URI http://*:41004
2) 将应用程序清单添加到正在生成的应用程序中,该应用程序在程序运行时请求管理员权限
在Visual Studio中,您需要添加项目的生成后步骤设置。假设您有名为“MyApplication.exe”的应用程序
清单文件将命名为“MyApplication.exe.manifest”,并包含以下内容:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0"
name="MyApplication"
type="win32"/>
<description>My Application</description>
<!-- Identify the application security requirements. -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false">
</requestedExecutionLevel>
</requestedPrivileges>
<applicationRequestMinimum>
<defaultAssemblyRequest permissionSetReference="FullTrust" />
<PermissionSet version="1" ID="FullTrust" Unrestricted="true" />
</applicationRequestMinimum>
</security>
</trustInfo>
</assembly>
有关应用程序清单的更多信息,请参见:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0"
name="MyApplication"
type="win32"/>
<description>My Application</description>
<!-- Identify the application security requirements. -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false">
</requestedExecutionLevel>
</requestedPrivileges>
<applicationRequestMinimum>
<defaultAssemblyRequest permissionSetReference="FullTrust" />
<PermissionSet version="1" ID="FullTrust" Unrestricted="true" />
</applicationRequestMinimum>
</security>
</trustInfo>
</assembly>
#define MANIFEST_RESOURCE_ID 1
MANIFEST_RESOURCE_ID RT_MANIFEST "MyApplication.exe.manifest"