小编Mic*_*son的帖子

区域无法加载MVC - 无法找到资源

我有个问题.我在MVC 3中有一个名为Page的区域可以正常工作.

我刚刚添加了一个名为Media的新区域,现在我得到了"无法找到该资源"的新区域.我疯了,因为它看起来就像PageArea一样有效.

这里是 MediaAreaRegistration.cs

public override string AreaName
    {
        get
        {
            return "Media";
        }
    }

    public override void RegisterArea(AreaRegistrationContext context)
    {
        context.MapRoute(
            "Media_default",
            "{controller}/{action}/{id}",
            new { action = "Index", id = UrlParameter.Optional }
        );
    }
Run Code Online (Sandbox Code Playgroud)

这是我的 global.asax

public static void RegisterGlobalFilters(GlobalFilterCollection filters)
    {
        filters.Add(new HandleErrorAttribute());
    }

    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            "Default", // Route name
            "{controller}/{action}/{id}", // URL with parameters
            new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
        ); …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc-3

4
推荐指数
2
解决办法
4429
查看次数

WCF REST和QueryString,错误的UriTemplate?

嗨,我有一个简单的WCF REST服务,我需要通过querystring获取一些看起来像这样的参数.

页= 1&RP = 10&sortname = ID&排序顺序= ASC&查询=&QTYPE =应用

我的UriTemplate无法正常工作,这里有什么问题?到目前为止只是试图获得页面参数.知道uri应该是什么样的吗?

[OperationContract]

    [WebInvoke(Method = "POST",
    BodyStyle = WebMessageBodyStyle.WrappedRequest,
    ResponseFormat = WebMessageFormat.Json,RequestFormat = WebMessageFormat.Json,
    UriTemplate = "/?page={page}")]

    [System.Web.Script.Services.ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Json)]
    JSONData GetLogList(string page);
Run Code Online (Sandbox Code Playgroud)

这是我的服务代码

   public class LogService : ILog
{
    [System.Web.Script.Services.ScriptMethod(ResponseFormat =    System.Web.Script.Services.ResponseFormat.Json)]

    public JSONData GetLogList(string page)
    {
        var logContext = new LogViewDataContext();
        var logsList = from logs in logContext.Logs select logs;
        //return logsList.Cast<Log>().ToString();


        var baseData = new JSONData();
        baseData.page = Int32.Parse(page ?? "1");
        baseData.total = logsList.Count();

        var cells = new …
Run Code Online (Sandbox Code Playgroud)

c# asp.net rest wcf web-services

3
推荐指数
1
解决办法
7675
查看次数

序列化淘汰视图模型,想法?

我试图在视图模型序列化到JSON,但我只拿到undefinedko.toJSON(PageViewModel)一部分.任何的想法?

function PageViewModel() {

    //Properties
    this.Name = ko.observable();
    this.Title = ko.observable();
    this.Language = ko.observable();

    //Seo
    this.SEOKeywords = ko.observable();
    this.SEODescription = ko.observable();
    this.SEOIndexPage = ko.observable();
    this.SEOGeoPositionLatitude = ko.observable();
    this.SEOGeoPositionLongitude = ko.observable();
    this.SEOGeoPositionPlaceName = ko.observable();
    this.SEOGeoPositionRegion = ko.observable();

}
Run Code Online (Sandbox Code Playgroud)
ko.applyBindings(new PageViewModel());
window.loadFirebugConsole;
console.log(ko.toJSON(PageViewModel));
Run Code Online (Sandbox Code Playgroud)

谢谢米克

javascript knockout.js

0
推荐指数
1
解决办法
333
查看次数

标签 统计

asp.net ×1

asp.net-mvc-3 ×1

c# ×1

javascript ×1

knockout.js ×1

rest ×1

wcf ×1

web-services ×1