我正在尝试创建一个系统,允许我通过Web应用程序或通过Windows服务来托管"WebAPI"网站.为此,我希望我的所有商务逻辑都包含在一个类库中,以便我可以在我的Windows服务和我的"Web"(IIS)服务中引用它.
我目前的想法是使用HttpSelfHostServer中包含的自托管选项.对于Web端,我只想创建一个标准的webapi网站,并添加一些对我的类库的引用.
我发现如果我将控制器放在与HttpSelfHostServer相同的命名空间中,它可以正常工作,但只要控制器在外部类库中,服务器就无法再解析到我的控制/操作的路由.
我的代码:
Windows服务:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Reflection;
using System.IO;
using System.Web.Http.SelfHost;
using System.Web.Http;
using System.Web.Http.Dispatcher;
using WebApiClasses;
using WebApiClasses.Controllers;
namespace WebAPISelfHost
{
public partial class Service1 : ServiceBase
{
private HttpSelfHostServer _server;
private readonly HttpSelfHostConfiguration _config;
public const string ServiceAddress = "http://localhost:8080";
public Service1()
{
InitializeComponent();
_config = new HttpSelfHostConfiguration(ServiceAddress);
//AssembliesResolver assemblyResolver = new AssembliesResolver();
//_config.Services.Replace(typeof(IAssembliesResolver), assemblyResolver);
_config.Routes.MapHttpRoute("DefaultApi",
"api/{controller}/{id}",
new { id = RouteParameter.Optional …Run Code Online (Sandbox Code Playgroud) 反正有标准JQuery-UI工具提示(http://jqueryui.com/tooltip/)的工具提示位置是跟随鼠标而不是单元格吗?
目前,该位置基于包含"title"属性的页面元素,该属性使用JQuery-UI中的位置规则(http://api.jqueryui.com/position/).
从我所看到的一切都是不可能的.
任何人都知道为什么这个jsfiddle中的微调器根本没有显示:
码:
$(function() {
$( "#tabs" ).tabs({
beforeLoad: function( event, ui ) {
ui.jqXHR.error(function() {
ui.panel.html(
"Couldn't load this tab. We'll try to fix this as soon as possible. " +
"If this wouldn't be a demo." );
});
},
spinner: '<img src="http://www.ajaxload.info/cache/FF/FF/FF/00/00/00/1-0.gif"/>'
});
});
Run Code Online (Sandbox Code Playgroud)
我的所有搜索都说spinner选项应该在加载选项卡时显示一个图标,但我从未在这里看到它...
他们似乎已经删除了这个选项?如果是这样,当前在慢速加载面板上显示旋转器的方法是什么?