小编TWi*_*ckz的帖子

无法使用Spring.NET将依赖项注入Azure WorkerRole对象

我在使用spring.net 4.0开发Web应用程序方面有一定的经验,nhibernate 3.0用于基于ASP.net的Web应用程序.最近我遇到了一种情况,我需要使用spring.net来注入属于WorkerRole该类的服务依赖项.我正常创建了app.config文件,正如我通常使用的spring.config文件一样.这是为了清楚起见.(我已经排除了根节点)

<configSections>
    <sectionGroup name="spring">
      <section name="context" type="Spring.Context.Support.WebContextHandler, Spring.Web" requirePermission="false" />
      <section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core" requirePermission="false" />
      <section name="parsers" type="Spring.Context.Support.NamespaceParsersSectionHandler, Spring.Core" />
    </sectionGroup>
  </configSections>
    <spring>
    <context>
      <!-- Application services and data access that has been previously developed and tested-->
      <resource uri="assembly://DataAccess/data-access-config.xml" />
      <resource uri="assembly://Services/service-config.xml" />
      <resource uri="AOP.xml" />
      <resource uri="DI.xml"/>
    </context>
    <parsers>
      <parser type="Spring.Data.Config.DatabaseNamespaceParser, Spring.Data" />
      <parser type="Spring.Transaction.Config.TxNamespaceParser, Spring.Data" />
      <parser type="Spring.Aop.Config.AopNamespaceParser, Spring.Aop" />
    </parsers>
  </spring>
Run Code Online (Sandbox Code Playgroud)

同样这是AOP.xml

<object id="FilterServiceProxy" type="Spring.Aop.Framework.ProxyFactoryObject, Spring.Aop">
    <property name="proxyInterfaces" value="Domain.IFilterService"/>
    <property name="target" ref="FilterService"/> …
Run Code Online (Sandbox Code Playgroud)

spring.net azure azure-worker-roles

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

简单的字符串替换出错

我试图通过表单提交(多部分编码)将一个json字符串发布到一个aspx页面,并根据反序列化的json字符串发回一个响应.(我真的需要通过表单提交来做到这一点.没有ajax)

我不知道为什么这不起作用,但每次我尝试一个简单的字符串替换,用json字符串中的双引号替换单引号.它似乎没有发生.

这是我所做的总结.

这是JSON字符串,

[["\n 22.02 13:15 \n ","\n \n \n \n ","\n \n \n \n ","\n \n \n "," \n Vereina\n ","\n \n ","\n 35 000\n ","\n 24.03.11\n ","\n Taiwan \n ","\n \n ","\n \n "]]
Run Code Online (Sandbox Code Playgroud)

要通过表单数据发送,我将所有"引号"替换为这样的引号,

[['\n \n22.02 13:15 \n','\n \n \n \n','\n \n \n \n','\n \n \n','\n Vereina \n ','\n \n','\n 35 000 \n','\n 24.03.11 \n','\n台湾\n','\n \n','\n \n'] ]

在服务器端,我正在更换新线路,因为我不需要它们,

[[' 22.02 13:15 ',' ',' ',' ','  Vereina ',' ',' 35 000 ',' 24.03.11 ',' Taiwan  ',' …
Run Code Online (Sandbox Code Playgroud)

c#

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

对于通过快速http响应返回的json对象,NodeJS'断言'测试失败

最近我开始对NodeJS感兴趣,最后我终于得到了一本NodeJS书.本书的一个简单示例是创建一个快速服务器并编写测试来验证作为练习的一部分公开的简单API.

请参考以下代码(我使用的是节点v0.8.8)

服务器(nodeExample.js)

     var express = require('express')
     var app = express.createServer()
     app.listen(8000)
     var msgs = []

     app.get('/', function(req, res) {
        res.send('Welcome to Node Twitter')
     })

     app.post('/send', express.bodyParser(), function(req, res) {
        if (req.body && req.body.tweet) {
           msgs.push(req.body.tweet)
           res.send({status:"ok", message:"Message received"})
        } else {
            res.send({status:"nok", message:"Message not received"})
        }
    })

    app.get('/tweets', function(req,res) {
    res.send(msgs)
    })
Run Code Online (Sandbox Code Playgroud)

考试

var http = require('http'),
assert = require('assert')
var opts = {
  host: 'localhost',
  port: 8000,
  path: '/send',
  method: 'POST',
  headers: {'content-type':'application/x-www-form-urlencoded'}
}

var req = http.request(opts, …
Run Code Online (Sandbox Code Playgroud)

javascript serverside-javascript node.js

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