我有两个独立的项目" MyWeb"和#34; MyAPI",MyWEB是一个单页的站点,有一个控制器和一个视图,它基于淘汰MVVM和对MyAPI Web应用程序的ajax请求,这两个项目包含在不同的apppool中。我已经将MiniProfiler与MyWEB网站集成在一起并且运行良好,但我只能看到主页的首次加载结果,然后所有数据都从MyAPI网络应用加载。所以,我需要将MiniProfiler与MyAPI项目集成,我有能力在MyWEB网站的页面上看到miniprofiler结果。我知道MiniProfiler发送获取结果的ajax请求,但我不明白为什么这些请求只能在同一个域中工作。例如,MyWEB位于domaint http://mywebsite.com中,我向域http://mywebapi.com/api中的MyAPI发送请求,这两个项目也可以放在两台不同的计算机上。那么,我现在所拥有的是什么
MyWEB global.asax
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
MiniProfilerEF6.Initialize();
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
AreaRegistration.RegisterAllAreas();
}
protected void Application_BeginRequest(object sender, EventArgs e)
{
}
protected void Application_EndRequest()
{
}
}
MyAPI global.asax
public class WebApiApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
MiniProfilerEF6.Initialize();
GlobalConfiguration.Configure(WebApiConfig.Register);
AreaRegistration.RegisterAllAreas();
}
protected void Application_BeginRequest(object sender, EventArgs e)
{
if (Request.IsLocal)
{
MiniProfiler.Start();
}
}
protected void Application_EndRequest()
{
MiniProfiler.Stop();
}
}
MyAPI web.config处理程序
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
<remove name="MiniProfiler"/>
<add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />
</handlers>