前端迁移时 ServiceStack api/auth/credentials returns 404
ServiceStack api/auth/credentials returns 404 on frontend migration
我正在将我的前端更改为 React,因此我使用 VS2015 开始了一个新项目。我已经用我的旧 API 服务配置了 ServiceStack。一切正常,除了一个:api/auth/credentials.
我尝试发送 POST 时收到 404。
我的 Configure
有:
public MyApphost() : base("My web services", typeof(MyApphost).Assembly) {}
和:
(在之前对插件的调用中)
IoC.Container.Register<IDbConnectionFactory>(c => new OrmLiteConnectionFactory(Dvtrck.Configuration.Manager.Current.Dsn, Dvtrck.Services.OrmLiteDialects.PostgreSQLDialectProviderLowerCase.Instance));
...(一些代码和)
Plugins.Add(new AuthFeature(() =>
new UserSession(),
new IAuthProvider[] {
new CustomAuthProvider(), // CustomAuthProvider : CredentialsAuthProvider
}));
我的 web.config 有:
<location path="api">
<system.web>
<httpHandlers>
<add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" />
</httpHandlers>
</system.web>
<!-- ServiceStack: Required for IIS7 -->
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
</handlers>
</system.webServer>
</location>
我已经检查过类似的问题,但我的情况不同。即使我在添加 AuthFeature
时也没有错误。我不明白为什么在我的旧项目中工作正常。
SetConfig(new HostConfig { HandlerFactoryPath = "api" });
我正在将我的前端更改为 React,因此我使用 VS2015 开始了一个新项目。我已经用我的旧 API 服务配置了 ServiceStack。一切正常,除了一个:api/auth/credentials.
我尝试发送 POST 时收到 404。
我的 Configure
有:
public MyApphost() : base("My web services", typeof(MyApphost).Assembly) {}
和:
(在之前对插件的调用中)
IoC.Container.Register<IDbConnectionFactory>(c => new OrmLiteConnectionFactory(Dvtrck.Configuration.Manager.Current.Dsn, Dvtrck.Services.OrmLiteDialects.PostgreSQLDialectProviderLowerCase.Instance));
...(一些代码和)
Plugins.Add(new AuthFeature(() =>
new UserSession(),
new IAuthProvider[] {
new CustomAuthProvider(), // CustomAuthProvider : CredentialsAuthProvider
}));
我的 web.config 有:
<location path="api">
<system.web>
<httpHandlers>
<add path="*" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" />
</httpHandlers>
</system.web>
<!-- ServiceStack: Required for IIS7 -->
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add path="*" name="ServiceStack.Factory" type="ServiceStack.WebHost.Endpoints.ServiceStackHttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" />
</handlers>
</system.webServer>
</location>
我已经检查过类似的问题,但我的情况不同。即使我在添加 AuthFeature
时也没有错误。我不明白为什么在我的旧项目中工作正常。
SetConfig(new HostConfig { HandlerFactoryPath = "api" });