I am using existing NopCommerce services in WCF project for my mobile application, after hosting in local IIS server, and by browsing, I am getting Exception as follows...
The server encountered an error processing the request. The exception message is 'Value cannot be null. Parameter name: instance'. See server logs for more details. The exception stack trace is:
at Autofac.RegistrationExtensions.RegisterInstance[T](ContainerBuilder
builder, T instance) at
Nop.Core.Infrastructure.DependencyManagement.ContainerManager.<>c__DisplayClass5.b__4(ContainerBuilder
x) at
Nop.Core.Infrastructure.DependencyManagement.ContainerManager.UpdateContainer(Action`1
action) at
Nop.Core.Infrastructure.DependencyManagement.ContainerConfigurer.Configure(IEngine
engine, ContainerManager containerManager, NopConfig configuration) at
Nop.Core.Infrastructure.EngineContext.CreateEngineInstance(NopConfig
config) at Nop.Core.Infrastructure.EngineContext.Initialize(Boolean
forceRecreate) at Nop.Core.Infrastructure.EngineContext.get_Current()
at NopServicesTest.AuthService..ctor() at
CreateNopServicesTest.AuthService() at
System.ServiceModel.InstanceContext.GetServiceInstance(Message
message) at
System.ServiceModel.Dispatcher.InstanceBehavior.EnsureServiceInstance(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc&
rpc) at
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&
rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean
isOperationContextSet)
Have you added WcfIntegration of AUtofac?
Related
I am trying to access my application deployed in IIS8. after successful authentication i am ending up with following error.
Server Error in '/' Application.
The requested operation cannot be completed. The computer must be trusted for delegation and the current user account must be configured to allow delegation.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Security.Cryptography.CryptographicException: The requested operation cannot be completed. The computer must be trusted for delegation and the current user account must be configured to allow delegation.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[CryptographicException: The requested operation cannot be completed. The computer must be trusted for delegation and the current user account must be configured to allow delegation.
]
System.Security.Cryptography.ProtectedData.Protect(Byte[] userData, Byte[] optionalEntropy, DataProtectionScope scope) +504
System.IdentityModel.ProtectedDataCookieTransform.Encode(Byte[] value) +89
[InvalidOperationException: ID1074: A CryptographicException occurred when attempting to encrypt the cookie using the ProtectedData API (see inner exception for details). If you are using IIS 7.5, this could be due to the loadUserProfile setting on the Application Pool being set to false. ]
System.IdentityModel.ProtectedDataCookieTransform.Encode(Byte[] value) +1082947
System.IdentityModel.Tokens.SessionSecurityTokenHandler.ApplyTransforms(Byte[] cookie, Boolean outbound) +95
System.IdentityModel.Tokens.SessionSecurityTokenHandler.WriteToken(XmlWriter writer, SecurityToken token) +809
System.IdentityModel.Tokens.SessionSecurityTokenHandler.WriteToken(SessionSecurityToken sessionToken) +109
System.IdentityModel.Services.SessionAuthenticationModule.WriteSessionTokenToCookie(SessionSecurityToken sessionToken) +206
System.IdentityModel.Services.WSFederationAuthenticationModule.SignInWithResponseMessage(HttpRequestBase request) +1124
System.IdentityModel.Services.WSFederationAuthenticationModule.OnAuthenticateRequest(Object sender, EventArgs args) +103571
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165
Have a look at https://github.com/brockallen/BrockAllen.MembershipReboot/issues/106
This solved the issue for us :
http://brockallen.com/2013/02/18/configuring-machine-key-protection-of-session-tokens-in-wif-and-thinktecture-identitymodel/
I am running an MVC web site on Windows Azure and using RavenDB embedded. If the web site is "cold" (unloaded from the Azure instance), I get the following error message on the first hit to the web site:
Server Error in '/' Application.
Failure writing to log file
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details:
Microsoft.Isam.Esent.Interop.EsentLogWriteFailException: Failure
writing to log file
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
Stack Trace:
[EsentLogWriteFailException: Failure writing to log file]
Microsoft.Isam.Esent.Interop.Api.Check(Int32 err) +21
Microsoft.Isam.Esent.Interop.Api.JetInit(JET_INSTANCE& instance) +23
Raven.Storage.Esent.TransactionalStorage.Initialize(IUuidGenerator
uuidGenerator, OrderedPartCollection`1 documentCodecs) +309
[InvalidOperationException: Could not open transactional storage:
C:\DWASFiles\Sites\reflix\VirtualDirectory0\site\wwwroot\App_Data\Data]
Raven.Storage.Esent.TransactionalStorage.Initialize(IUuidGenerator
uuidGenerator, OrderedPartCollection`1 documentCodecs) +443
Raven.Database.DocumentDatabase..ctor(InMemoryRavenConfiguration
configuration) +994
Raven.Client.Embedded.EmbeddableDocumentStore.InitializeInternal()
+313 Raven.Client.Document.DocumentStore.Initialize() +463 Reflix.MvcApplication.InitializeRavenDB(String dataDirectory, Boolean
rethrowException) +135 Reflix.MvcApplication.Application_Start()
+131
[HttpException (0x80004005): Could not open transactional storage:
C:\DWASFiles\Sites\reflix\VirtualDirectory0\site\wwwroot\App_Data\Data]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext
context, HttpApplication app) +9859441
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr
appContext, HttpContext context, MethodInfo[] handlers) +118
System.Web.HttpApplication.InitSpecial(HttpApplicationState state,
MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr
appContext, HttpContext context) +336
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr
appContext) +296
[HttpException (0x80004005): Could not open transactional storage:
C:\DWASFiles\Sites\reflix\VirtualDirectory0\site\wwwroot\App_Data\Data]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9873784
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)
+101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest
wr, HttpContext context) +254
Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.0.30319.18033
If I wait a minute or two, the web site comes up fine. So clearly this is a first-start issue. Anyone have any ideas how to resolve the problem?
My configuration:
MVC 4
.NET 4.5
RavenDB 2.0.2360
Update: The Azure team is looking at this as a possible defect with the Azure Websites. More updates as soon as I hear anything.
This was confirmed as a bug in Azure Websites, which has now been rolled out. I don't have any additional details, but the site now works (8/30/2013) and I have made no structural changes to the code.
Look at the event log, it will give you more info.
It looks like something is prevent proper write to the logs, check permissions, in particular, you may have CREATE_FILE permission, but not WRITE permission
I had a simple program , a asp.net website in which i added a webservice
One of the web methods accessed a CRM `
[WebMethod]
public bool RecordExists (String projectName)
{
var service = GetService("http://localhost/EventoCorp/");
Entity project = new Entity("new_project");
/*PROJECT DETAILS*/
project.Attributes["new_name"] = projectName;
var request = new RetrieveDuplicatesRequest
{
BusinessEntity = project,
MatchingEntityName = "new_project",
PagingInfo = new PagingInfo() { PageNumber = 1, Count = 50 }
};
Console.WriteLine("Retrieving duplicates");
var response = service.Execute(request);
EntityCollection collection = (EntityCollection)response.Results["DuplicateCollection"];
return collection.Entities.Count > 1 ? true : false;
}
When I press F5. the project runs fine . I invoke this record exists method , and it correctly brings data from the CRM 2011
However when i deploy this application on IIS 7.5 . I get greeted by this terribly uninformative exception
System.ServiceModel.FaultException: The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
I am a CRM 2011 noob . No idea what is going on . Please help me
This exception happens in the client you use when trying to connect your web service. It says only that unhandled exception happened on server side, but has no information about exception. Also there is advice to enable IncludeExceptionDetailInFaults in order to pass to the client unhandled exception details. But there is also other way to see what is going on, it's attach to IIS process and debug your web service.
Also it would be better add exception handling to your code, because now code is completely unsafe. Different exceptions can happen when you are accessing CRM, like authentication exception etc. Also you can just get null instead of collection you suppose to be there.
When you deploying this code to IIS authentication issues are possible, since IIS is working under NETWORK SERVICE account. And in case if CRM uses Windows Authentication it's possible your request will not be authorized.
I have a Clustered Windows Hosting site which currently hosts an MVC Web Application using a MYSQL backing database.
What I have been trying to do for the past three weeks is host a WCF Data Service exposing the database behind the website to be consumed in a WPF application which will be installed on Windows machines.
I have followed every single tutorial that I have come across. None of them have worked and all of them give the example of using http://localhost as the location of where the Webservice is called from.
I have limited experience with Asp.Net and MVC but have published working websites before and as I mentioned currently am running a fully functional MVC web Application. I also have extensive .Net knowledge and experience, but, for the life of me cannot fathom this out at all.
I have seen no real examples of a WCF site being hosted from within a clustered hosting scenario. Practically every example I see mentions using IIS, but I do not have access to IIS on my hosting.
Could anyone point me in the right direction to a tutorial that will allow me to use a WCF service, or am I completely barking up the wrong tree?
Okay, an Update: After much experimenting I came across the following attribute and used it
[System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)]
This gave me an error which appeared to indicate that the Data Service was trying to access files on my local hard drive, indicating that I'd fudged some kind of reference. I also realised that I hadn't set up the Membership profiles and so scrapped my Data Service starting again.
First I added the Asp Membership profiles, then the Entity Model, set the permissions and used that attribute again and although looking more hopeful still got the following error.
The exception message is 'The specified store provider cannot be found in the configuration, or is not valid.'. See server logs for more details. The exception stack trace is:
at System.Data.EntityClient.EntityConnection.GetFactory(String providerString) at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString) at System.Data.EntityClient.EntityConnection..ctor(String connectionString) at System.Data.Objects.ObjectContext.CreateEntityConnection(String connectionString) at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName) at RotaSolutions.WCF.Models.rotasolu_crmEntities..ctor() in C:\Users\Paul\Dropbox\Projects\WCF\RotaSolutions.WCF\RotaSolutions.WCF\Models\CRMModel.Designer.cs:line 34 at invoke_constructor() at System.Data.Services.DataService1.CreateDataSource() at System.Data.Services.DataService1.CreateDataSourceInstance() at System.Data.Services.DataService1.CreateProvider() at System.Data.Services.DataService1.HandleRequest() at System.Data.Services.DataService`1.ProcessRequestForMessage(Stream messageBody) at SyncInvokeProcessRequestForMessage(Object , Object[] , Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage41(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
Although, still not able to use it. This is giving me more hope than previously. Again, if anyone has any suggestions, I'd be grateful to receive them.
I have actually managed to solve this. I'd post the full answer but can't due to sever formatting problems with the editor here so I'll have to do the short version.
Basically, I removed the MySQL version that I was using, downloaded the latest version and installed and added that reference.
I also added to the web.config a DbProviderFactories linking to the MySQL reference. Like I said, I'd post the code but this formatting system keeps rejecting my attempts.
I'm currently working on an Silverlight 3 project, I'm using 2 machines to test it.
"harbinger" is the web server running Win7 + IIS . I've deployed the webpage and the WCF webservice to that machine.
I've entered the following url's in my browser :
http://harbinger:43011/UserService.svc
http://harbinger:43011/UserService.svc?wsdl
and got pages load expected contents for both
Next I've decided to check if I can call the webservice from my machine, I've added the ServiceReference, executed a call to one of the methods and .... BOOM :
System.ServiceModel.CommunicationException was unhandled by user code
Message="An error occurred while trying to make a request to URI 'http://harbinger:43011/UserService.svc'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details."
StackTrace:
at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)
at Energy.USR.UserServiceClient.UserServiceClientChannel.EndGetAllUsers(IAsyncResult result)
at Energy.USR.UserServiceClient.Energy.USR.UserService.EndGetAllUsers(IAsyncResult result)
at Energy.USR.UserServiceClient.OnEndGetAllUsers(IAsyncResult result)
at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)
InnerException: System.Security.SecurityException
Message=""
StackTrace:
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
InnerException: System.Security.SecurityException
Message="Security error."
StackTrace:
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState)
InnerException:
Can someone explain what just happened? What do I need to do to avoid this?
See this blog post - I think that's the root cause of your problem:
Enabling cross-domain calls for Silverlight apps on self-hosted web services
or this one here:
WCF and Silverlight with cross-domain issue
Without any special policy files, you won't be able to call cross-domain in Silverlight.