无法使用正确的web.config将IErrorHandler集成到我的项目中
我有一个成功运行的WCF,正在被.net 4中的webclients使用,但是当我尝试将IErrorhandler设置为全局错误记录器作为所有我的所有服务方法的捕获时,事情正在快速失败 - 主要与web.config部分有关!请帮忙.
这三项服务是:IReport,IServiceCustomer,IServiceUser
在一个名为MyErrorClass.cs的单独类中实现了IErrorHandler,如下所示:
namespace CustomerWcfService
{
public class WcfErrorHandler : IErrorHandler
{
/// <summary>
/// Enables the creation of a custom <see cref="T:System.ServiceModel.FaultException`1"/> that is returned from an exception in the course of a service method.
/// </summary>
/// <param name="error">The <see cref="T:System.Exception"/> object thrown in the course of the service operation.</param><param name="version">The SOAP version of the message.</param><param name="fault">The <see cref="T:System.ServiceModel.Channels.Message"/> object that is returned to the client, or service, in the duplex case.</param>
public void …Run Code Online (Sandbox Code Playgroud) 我喜欢SS但我正在试图对我的业务层进行单元测试.我是单位测试和模拟的新手,并且正在阅读NSubstitute,因为这看起来像一个有趣的模拟层.
我的文件结构大致如下:
MainAppHostProject*
|
-AppStart
-AppHost <-- standard apphost
DtoProject*
|
-HelloWorldDto <-- simple POCO to
ServiceLayerProject*
|
-HelloWorldService <-- service interface that merely passes/sends Dtos to/from business layer
BusinessLayerProject*
|
-HelloWorldManager <-- logic to construct response and this class extends 'Service' (letting me access Db, session, etc)...sidenote: maybe i shouldve called this a HelloWorldRepository?
-CustomAuthProvider
-CustomUserSession
DaoProject*
|
-HelloWorldDao <-- POCO of table structure
Run Code Online (Sandbox Code Playgroud)
Apphost指向HelloWorldService程序集并将SQL Server数据库注册为标准数据库.
一切都很有效,我已经能够以更清洁的方式构建逻辑.不幸的是我想开始进行单元测试,但我不知道如何解耦数据库.
我试图在内存数据库中注册一个假的,但后来我认为我在SQL Server和SQLite方式中使用代码来获取身份等方面存在不兼容问题.
// container.Register<IDbConnectionFactory>(c => new OrmLiteConnectionFactory(":memory:", false, SqliteOrmLiteDialectProvider.Instance));
// container.Register<IDbConnectionFactory>(c => …Run Code Online (Sandbox Code Playgroud) 我想部署我的应用程序并查看Appharbor或Amazon beanstalk以获取我的.net项目.
我担心安全性,并被微软(因此Azure)推迟成为Prism丑闻中的关键角色.
在欧洲,我开始倾向于冰岛的东道主,因为他们的绿色证书和坚持言论自由.其他人推荐Hetzner的速度.我知道有些提供商拥有欧洲数据中心,但这是否意味着他们在美国之前首先受到欧洲法律的约束,即他们不能"轻易"窥探?
.Net开发社区应该在哪里转向在线运行安全应用程序?
(我希望这篇文章不会以一个便宜的借口关闭,因为它有争议,但我真的遇到了这个问题).
如何在我的C#类模型中定义postgis'geography'类型,以便OrmLite可以轻松地将其传递给Postgresql,这样我除了将空间数据保存到'geography'列之外还可以运行空间查询?
我正在尝试将已发布的.net项目的文件压缩文件上传到Amazon弹性beanstalk,但它一直在日志中抛出错误,说iisApp不存在.怎么修?
Servicestack太棒了.我正在将它用于我的Xamarin项目(monotouch和monodroid).
用户登录并由ServiceStack授权.会话详细信息保存在内存中,即userId,Ipaddress等.
但是添加websocket功能的最佳方法是什么,以便我可以将通知推送给这些用户?
或者最好只是在客户端上打开一个常规的websocket并让一个小的websocket服务器以某种方式从ServiceStack读取会话数据(用户Ipaddress)以便将定制的消息转发给客户端?
push-notification xamarin.ios websocket xamarin.android servicestack
在飞镖我想这样做:
var s = "2018-11-23T04:25:41.9241411Z"; // string comes from a json but represented here for simplicity like this
var d = DateTime.parse(s);
Run Code Online (Sandbox Code Playgroud)
但它抛出一个空值。
Dart 似乎无法解析 iso 8601 日期时间格式。我找到了一个名为“Iso8601DateTimeSerializer”的自定义序列化程序,但如何将其添加到我的 flutter 应用程序中?
链接:https : //reviewable.io/reviews/google/built_value.dart/429#-
此处的说明仅指示使用“SerializersBuilder.add”将其添加到 dart,但我是新手,无法找到方法?
链接:https : //pub.dartlang.org/documentation/built_value/latest/iso_8601_date_time_serializer/Iso8601DateTimeSerializer-class.html
我正在使用Xamarin Studio使用MvvmCross开始TDD.我首先尝试测试发布的消息对视图模型的影响,以便仅在收到相应的消息时才执行逻辑.
我已经将Stuart的一些优秀教程混合在一起,导致成功传播位置数据,以查看模型,然后在IOS视图上更新一些文本控件,地图标记等.
但在我进一步深入研究之前,我想使用TDD进行编码.如何人工设置viewmodel并在我的测试工具中人为地将消息发布到它?:
public class MyViewModel : MvxViewModel
{
private readonly MvxSubscriptionToken _token;
public MyViewModel(ILocationService service, IMvxMessenger messenger)
{
//weak reference
_token = messenger.Subscribe<LocationMessage>(OnLocationMessage);
}
private void OnLocationMessage(LocationMessage locationMessage)
{
Lat = locationMessage.Lat;
Lng = locationMessage.Lng;
// Console.WriteLine("on loc msg {0:0.0000}, {1:0.0000}", Lat, Lng);
}
private double _lng;
public double Lng
{
get { return _lng; }
set
{
_lng = value;
RaisePropertyChanged(() => Lng);
}
}
private double _lat;
public double Lat
{
get { return _lat; } …Run Code Online (Sandbox Code Playgroud) 我想从存储库而不是服务类访问数据库(为了增加分离 - 不确定这是否有点过分)即
public class TodoRepository // : BaseRepository derive the class and inject IDbConnection somehow?
{
public List<Todo> GetByIds(long[] ids)
{
return Db.Select<Todos>(t => Sql.In(t.id, ids)); <-- how to get 'Db' in here
}
}
Run Code Online (Sandbox Code Playgroud)
服务基类已经允许使用'Db'对象通过ormlite直接访问数据库,因此:
public class Service : IService, IRequiresRequestContext, IServiceBase, IResolver, IDisposable
{
public virtual IDbConnection Db { get; }
}
Run Code Online (Sandbox Code Playgroud)
让我相信我可以这样做,所以我可以在派生类中使用'Db':
public class BaseRepository: IDisposable
{
public virtual IDbConnection Db { get; }
}
Run Code Online (Sandbox Code Playgroud)
我的AppHost中有这一行来传递连接字符串并注册存储库:
container.Register<IDbConnectionFactory>(c => new OrmLiteConnectionFactory(connectionString, SqlServerDialect.Provider));
container.Register(new TodoRepository());
Run Code Online (Sandbox Code Playgroud)
如何将IDbConnection注入或自动装载到BaseRepository类?我已经尝试在AppHost中注册并自动装配BaseRepository而没有运气.
servicestack ×3
appharbor ×1
dart ×1
flutter ×1
funq ×1
geography ×1
hosting ×1
ios ×1
iso8601 ×1
mvvmcross ×1
npgsql ×1
orm ×1
paas ×1
postgis ×1
repository ×1
security ×1
sql ×1
sqlite ×1
tdd ×1
unit-testing ×1
wcf ×1
web-config ×1
websocket ×1
xamarin.ios ×1