Using Ninject With WCF Services Within Web Applications Appdomain?
Feb 4, 2011
It's my understanding that if you want to use the WCF-Ninject extension, it assumes that you are hosting your WCF services in their own AppDomain.
I'm already using the Ninject.Web extension and asp.net compatibility mode to get at the Membership Provider and Session.
Is there a way utilize my Ninject with my WCF services that are hosted in the same AppDomain as my Web Application?
View 1 Replies
Similar Messages:
Jun 7, 2010
I've been worked with web services so far, and I'm interested in expanding my services to console applications as well so I started digging up with WCF but I'm conserned that I won't be able to use the HttpContext collection that I've been used to do with web services one important thing which is to generate a random value from HttpContext.Current.Request.ServerVariables["ALL_HTTP"] that I need to reckon if it's the same or at least near what machine that is calling my service. How can I overcome this problem?
I need to know what machine is calling to count the number of attempts to login into my system for example. So must do it inside of the svc code otherwise if I let the client inform what ip address or what computer he is using, anyone could forge this argument and surpass by another machine. May be I'm approaching this matter wrongly. And I should count the number of attempts per state session, but how is it done?
View 1 Replies
Nov 22, 2010
How to communicate with applications which build in lets say SAP,Java,Ruby or any other technology through web services
View 3 Replies
Jun 10, 2010
Ive searched everywhere, i can't seem to find a way to implement ninject in my project. Ive heard of deriving MvcApplication to the NinjectHttpApplication. But NinjectHttpApplication isnt found even if i add the lib to the reference. I can't find Ninject.Web.Mvc. Does anyone have a guide somewhere in order to make this work, all i want to do is be able to bind my interface from my domain to existing implementation.
View 4 Replies
Jan 27, 2010
With NInject (preferably 2.0), what options do we have wrt wiring up our object dependencies in a web application?
Can they be defined in an XML configuration file?
Or does it have to be done via code?
View 4 Replies
Mar 28, 2011
having trouble defining bindings using ninject.I am in a standard ASP.NET WebForms application. I have defined an http handler to Inject dependencies in pages and controls (Property injection).Here is what I am trying to do:I am creating a custom combobox usercontrol. Based on the value of an enum on that combobox, I want to be able to Inject a different object in a property (What I am trying to do is a bit more involved than that, but answer to this should be enough to get me going).
View 1 Replies
Sep 5, 2010
Is it possible to add a new object that Ninject should be responsible for (lifetime, injection etc.) in an ASP.NET application after the Application_Started event is fired?
My application needs to dynamically designate objects that should be tracked well after the application is started
View 2 Replies
Sep 26, 2010
What is this Error For? I repaired my Vs but this did not solve it.
My OS : Windows 7 64 bit home edition. Visual studio 2010 Ultimate. Does My question need more information?
View 3 Replies
Dec 22, 2010
I am writing a plugin architecture. My plugin dlls are located in a sub directory from where the plugin manager is running. I am loading the plugins into a separate AppDomain as the following:
string subDir;//initialized to the path of the module's directory.
AppDomainSetup setup = new AppDomainSetup();
setup.PrivateBinPath = subDir;
setup.ApplicationBase = subDir;
AppDomain newDomain= AppDomain.CreateDomain(subDir, null, setup);
byte[] file = File.ReadAllBytes(dllPath);//dll path is a dll inside subDir
newDomain.Load(file);
However. newDomain.Load returns an assembly which the currently domain attempts to load. Because the plugin dlls are in a sub directory, the current domain cannot and should not see these dlls and the current domain throws a FileLoadException"ex = {"Could not load file or assembly ... or one of its dependencies."
The question is, can we load an assembly into a separate AppDomain without it returning the loaded assembly?
I know I can add a handler for the AssemblyResolve event in the current domain and return a null, but I would prefer to not to go this route.
View 1 Replies
Apr 11, 2010
I'm doing shared hosting with GoDaddy and I developed a sample ASP.NET MVC app using Castle Windsor and unfortunately, it didn't work in a medium trust setting. Specifically, I got this error: "[SecurityException: That assembly does not allow partially trusted callers"... etc. GoDaddy is sadly not flexible in their trust policy.
I'm not tied to Windsor and would like to try another one that will work under Medium Trust. I'd actually like to use NInject, but I've read people having mixed success. The only one I've read that works with no problem is Microsoft's Unity.My question is, does NInject work in medium trust? If not, what are my options?
View 2 Replies
Mar 4, 2011
I'm playing around with dependency injection in a web-forms website al a Ninject and whilst I have had no problem at all getting the site running smoothly I've had a pretty big problem when viewing individual pages using design mode.
I wouldn't normally use design mode but dragging and dropping web user controls onto a design space is the easiest way by far to add them to a page.
The set-up is pretty much identical to guidelines here The error on the design page is thus:
The type "page name" requests an injection, but no kernel has been registered for the web application. ensure that your project defines a NinjectHttpApplication.
I'm using Asp.Net 4.0 with Ninject and Ninject.Web 2.2 utilizing property injection
View 1 Replies
Dec 16, 2010
I have an aspx page that I would like to have injected a reference to a user control. The user control is stored in a seperate assembly and loaded at runtime. After injected the user control it should then be loaded into the control collection of the page.
Everything seems to be working fine expect the point of adding the control to the page. There is no error but the UI for the control doesn't show.
global.asax.cs
protected override Ninject.IKernel CreateKernel()
{
var modules = new INinjectModule[] { new MyDefaultModule() };
var kernel = new StandardKernel(modules);
// Loads the module from an assembly in the Bin
kernel.Load("ExternalAssembly.dll");
return kernel;
}
and here is how the external module is defined in the other assembly:
public class ExternalModule : NinjectModule
{
public ExternalModule() { }
public override void Load()
{
Bind<IView>().To<controls_MyCustomUserControlView>();
}
}
The debugger shows that when the app is run, the Load on the external module is being called, and the dependency gets injected into the page.
public partial class admin_MainPage : PageBase
{
[Inject]
public IView Views { get; set; }
At this point when trying to add the view (here a user control) to the page, nothing is shown. Is this something to do with the way the user control is created by Ninject? The loaded control seems to have an empty control collection.
inside aspx page
var c = (UserControl)Views;
// this won't show anything. even the Control collection of the loaded control (c.Controls) is empty
var view = MultiView1.GetActiveView().Controls.Add(c);
// but this works fine
MultiView1.GetActiveView().Controls.Add(new Label() { Text = "Nice view you got here..." });
and finally the view/user control:
public partial class controls_MyCustomUserControlView : UserControl, IView
{
}
It contains just one label:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MyCustomUserControlView.ascx.cs" Inherits="controls_MyCustomUserControlView" %>
<asp:Label Text="Wow, what a view!" runat="server" />
View 1 Replies
Oct 30, 2010
In my ASP.NET app, I'm attempting to add another directory to be have the DLLs in it shadow copied.
The only method I found that will allow m to do this is AppDomain.CurrentDomain.SetShadowCopyPath.
However, this method is marked as Obsolete. MSDN has this to say about it
SetShadowCopyPath(String path) Message: AppDomain.SetShadowCopyPath has been deprecated. investigate the use of AppDomainSetup.ShadowCopyDirectories instead.
However, the AppDomainSetup.ShadowCopyDirectories property doesn't seem to change whenever I set a value to it.
AppDomain.CurrentDomain.SetupInformation.ShadowCopyDirectories = "mydirectory;bin"; string test = AppDomain.CurrentDomain.SetupInformation.ShadowCopyDirectories; // returns bin, which was the original directory
Is there a reason that it won't change and is there a work around?
View 1 Replies
Oct 9, 2010
Im trying to implement an unit of work pattern by passing an unit of work instance into my repositories.
Relevant code from Global.asax.
[code]....
What i want is that a maximum of 1 instance of SqlUnitOfWork is created per request and is passed into my repositories (via their respective constructors).
Is the InRequestScope() method on the IUnitOfWork binding enough? If not how can i achieve this?
View 1 Replies
Jan 24, 2011
ive tried to build some base project with above technologies. I wanted maximum flexibility and testability so i tried to use patterns along the way to make this as a base for future projects. However, it seem.something is wrong or whatever and i really need help here. So
i have two questions :1- Is there anything wrong with my current code ? Ive applied patterns correctly ?
2- Why do this code actually connect to the database, create it, but doesnt support insert even if i perform the corrects operation ? (Look at the end of the post for details about this error)
I have two entities : Comment and Review
COMMENT [Code]....
REVIEW[Code].... I built up a base repository for each of them this way :GENERIC REPOSITORY[Code]...For specific operations, i use an interface :[Code]....So i am getting the generics operations from the abstract class plus the specific operations :[Code]....As you figured out, i also use a database factory will produce the database context :DATABASE FACTORY [Code]....DISPOSABLE (Some extensions methods...)[Code]....DATABASE [Code]....And to finish, i have my unit of work....UNIT OF WORK[Code]....I also binded using Ninject the interfaces :NINJECT CONTROLLER FACTORY [Code]....however, when i call in the constructor ...[Code]....
This seem to create the database but doesnt't insert anything in the database in EF4. It seem that i may figured out the problem.. while looking at the database object.. the connection state is closed and server version throw an exception of this kind :
ServerVersion = '(((System.Data.Entity.DbContext (_database)).Database.Connection).ServerVersion' threw an exception of type 'System.InvalidOperationException'
I am doing the right things ? Is there anything wrong in what ive built ? Also if you have recommandation about the code i posted, i would be glad. I am just trying to the learn the right way for building any kind of application in MVC 3. I want a good a start.
I use :
- Entity Framework 4 Code-First CTP 5
- ASP.NET MVC 3
- Ninject as DI Container
View 4 Replies
Aug 6, 2010
I will like to add Rhino Service Bus to my ASP.NET web application but using Ninject as the DI Container. So far all examples I keep seeing use Castle Windsor which I don't want to use since we already use Ninject.Are there any tutorials out there which show how to add Rhino Service Bus to an ASP.NET web application without a direct dependency on Castle Windsor (e.g. using Ninject)?
View 1 Replies
Nov 25, 2010
Just Wondering. Can we use Html Helpers/Repositary Pattern/Ninject in Webforms?
View 1 Replies
Feb 3, 2010
I would like to reset/clear an item in the Cache, but without resetting the application or writing a specialized page just for this. ie, a non-programmatic solution.
View 3 Replies
Jan 20, 2010
I have an asp.net web application that allows users to upload files to an 'uploads' directory that is located in the same virtual directory as the web app. Each uploaded file goes into a temporary sub directory that is named after the user's session id. Once I'm finished with the files, I delete the temp sub directory. The only problem is that when a sub directory is deleted, the AppDomain gets recycled and kills all user sessions (using inproc session state). The culprit appears to be a FileChangesMonitor that watches for changes in all sub directories in the application.
The following code works great in IIS 6.0 running on Windows Server 2003 to disable the FileChangesMonitor for sub directories, but for some reason it's not working in IIS 7.0 on Windows Server 2008:
System.Reflection.PropertyInfo p = typeof(System.Web.HttpRuntime).GetProperty("FileChangesMonitor", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
object o = p.GetValue(null, null);
System.Reflection.FieldInfo f = o.GetType().GetField("_dirMonSubdirs", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.IgnoreCase);
object monitor = f.GetValue(o);
System.Reflection.MethodInfo m = monitor.GetType().GetMethod("StopMonitoring", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
m.Invoke(monitor, new object[] { });
I found another solution that disables the FileChangesMonitor altogether here. But this is not the ideal solution as I still want to monitor all other files except for the temp sub directories in the 'uploads' directory. Why does this work in IIS 6.0 and not in IIS 7.0? In IIS 7.0 can you specify sub directories in a virtual folder you want to disable recycling on? Is there another way to do this without using reflection?
View 2 Replies
Jul 30, 2010
Maxima.exe is a Computer Algebra System built as a native code rather than a managed code. MyService works as a socket server, it will instantiate a new process of Maxima for each browser submitting mathematics expression to Web Server. I cannot use AppDomain here because Maxima is a native code. However I want security policies provided by AppDomain such as restriction to write data on file system.My question is, how can I get the AppDomain-like security policies when I instantiate Maxima in a process rather than in an AppDomain?
View 1 Replies
Apr 30, 2010
How does one control the application recycle settings for an ASP.NET application runnin on mod_mono & Apache ?
On IIS6 & 7 there was an option to specify either a time period, a number of requests, etc. when the AppDomain would be recycled and the application would basically do an Application_End() / Application_Start().
I am seeing the same behaviour on mod_mono & Apache ,but I can't find where to change the settings.
View 2 Replies
Mar 2, 2011
I am creating a sandbox AppDomain so I can load up an assembly and release it.
var sandbox = AppDomain.CreateDomain("Sandbox", null,
AppDomain.CurrentDomain.SetupInformation);
However when I Load an assembly into to sandbox, the debugger crashes. I am in ASP.NET.
var assemblyName = AssemblyName.GetAssemblyName(assemblyPath);
var assembly = pluginDomain.Load(assemblyName); // crash here
View 1 Replies
Feb 4, 2011
How to Find All the Web Services and Windows Services Running on a Server in ASP.Net. I have the server details with me and want to find all the Web services running on it.
View 1 Replies
Mar 4, 2010
I'm trying to develop a web application that dispatch (Dispatcher) to multiple versions of another webapp on a per-request basis. To to that end, I'm using ApplicationManager.CreateObject to create new AppDomains running the web app in question, but the new app domains seem to be failing to load the Dispatcher's DLL (and I'm copying the DLL over to the web app's bin directory, so I'm pretty sure it's there).
[code]....
The Appbase seems to be pointing at the root of the development server, rather than the path passed in to ApplicationManager.CreateObject and it only seems to be searching directories under the development server which seems strange. how to make the new AppDomain search for the DLL in the web app's root rather than under the development server?
View 1 Replies
Jun 18, 2010
I have developed website using .NET 2.0 and I am trying to host the same on IIS 5.1. It works on my machine where I am domain user with all the administrator rights on my machine. I can access the website from other machine on the network using IP address of my machine in URL
But it fails when I am trying to host on my clients machine. Here is the list of errors I get.
I already tried using
1. iisreset
2. aspnet_iis -i
Here is the list of the errors that I get
[Code]....
View 2 Replies