server error in '/Services_DEV' application - asp.net

I was getting the below error as I was unable to find the correct solution...Actually I found some solutions, and I tried them but none in the solutions helped me to resolve the below error.
Server Error in '/Services_DEV' Application.
Retrieving the COM class factory for component with CLSID {9F8D4F16-0F61-4A38-98B3-1F6F80F11C87} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
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.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {9F8D4F16-0F61-4A38-98B3-1F6F80F11C87} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
Source Error:
[No relevant source lines]
Source File: c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\rhenusservices_dev\19c0008c\aab4c325\App_Web_default.aspx.cdcab7d2.csyixg6l.0.cs Line: 0
Stack Trace:
[UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {9F8D4F16-0F61-4A38-98B3-1F6F80F11C87} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).]
_Default..ctor() +141
ASP.default_aspx..ctor() in c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\rhenusservices_dev\19c0008c\aab4c325\App_Web_default.aspx.cdcab7d2.csyixg6l.0.cs:0
__ASP.FastObjectFactory_app_web_default_aspx_cdcab7d2_csyixg6l.Create_ASP_default_aspx() in c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\rhenusservices_dev\19c0008c\aab4c325\App_Web_default.aspx.cdcab7d2.csyixg6l.1.cs:0
System.Web.Compilation.BuildResultCompiledType.CreateInstance() +32
System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp) +109
System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +31
System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +40
System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +167
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +128
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1016

Related

hosting an application with the hosting provider (shared hosting)

I have an application that is working perfect on my local machine but it gives an error when uploaded in a hosting space. I called the technical support of my hosting provider and they are not technical enough to know what the problem is, they only tell me that they do no allows full trust level.
below is the error I get when visiting my URL:
Server Error in '/' Application.
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
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:
[SecurityException: Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Delegate.DelegateConstruct(Object target, IntPtr slot) +0
Owin.Loader.DefaultLoader..ctor(Func'3 next, Func'2 activator, IEnumerable'1 referencedAssemblies) +69
Microsoft.Owin.Host.SystemWeb.OwinBuilder.GetAppStartup() +65
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +28
System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +86
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +106
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +418
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
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34280
Screenshot of the error
Can anyone help me resolving this problem?
You're calling the Microsoft.Owin DLLs and those require full trust, they won't run under medium trust. If your host won't support full trust, you'll need to find an alternative to Microsoft.Owin that DOES run in medium trust, or switch hosting providers to one who DOES support full trust.
See this post Is trying to develop for Medium Trust a lost cause? for more details.

security exception in using routing in asp.net after doployment

i'm using routing in asp.net ,in local host every thing good , but after deployment , when browsing menu get below exception
Security Exception
Description: The application attempted to perform an operation not
allowed by the security policy. To grant this
application the required
permission please contact your system administrator or
change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException:
Request for the permission of type 'System.Security.Permissions.
SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' failed.
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:
[SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Web.Security.UrlAuthorizationModule.CheckUrlAccessForPrincipal(String virtualPath, IPrincipal user, String verb) +42
Microsoft.AspNet.FriendlyUrls.Abstractions.UrlAuthorizationModuleWrapper.CheckUrlAccessForPrincipal(String virtualPath, IPrincipal user, String verb) +14
Microsoft.AspNet.FriendlyUrls.FriendlyUrlRoute.GetWebObjectFactory(HttpContextBase httpContext, String modifiedVirtualPath) +159
Microsoft.AspNet.FriendlyUrls.FriendlyUrlRoute.Resolve(HttpContextBase httpContext, IList1 extensions, String virtualPathOverride, IFriendlyUrlRouteSupportFunctions supportFunctions) +220
Microsoft.AspNet.FriendlyUrls.FriendlyUrlRoute.Microsoft.AspNet.FriendlyUrls.Abstractions.IFriendlyUrlRouteSupportFunctions.Resolve(HttpContextBase httpContext, IList1 extensions, String virtualPathOverride) +16
Microsoft.AspNet.FriendlyUrls.FriendlyUrlRoute.GetRouteData(HttpContextBase httpContext, String pathOverride, IFriendlyUrlRouteSupportFunctions supportFunctions) +140
Microsoft.AspNet.FriendlyUrls.FriendlyUrlRoute.GetRouteData(HttpContextBase httpContext) +8
System.Web.Routing.RouteCollection.GetRouteData(HttpContextBase httpContext) +233
System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context) +60
System.Web.Routing.UrlRoutingModule.OnApplicationPostResolveRequestCache(Object sender, EventArgs e) +82
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69
any advice
This indicates, that your application is not running with Full trust on your IIS, or the trust level is not high enough.
Please follow the following checklist:
Open up IIS
Click on your website on the left panel
Double click on .NET Trust Level in the right panels.
Set the Trust Level to Full (internal)

Invalid URI error with MongoDB connection string but only when run on Azure? (ASP.NET Web Role)

I have an ASP.NET MVC Web Role that communicates with a remote server running MongoDB. The connection string has the credentials in it. When I run the the MVC Web Role on localhost it works fine. However, when I publish the MVC Web Role to Azure and run it I get the following error/stack trace:
Invalid URI: There is an invalid sequence in the string.
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.UriFormatException:
Invalid URI: There is an invalid sequence in the string.
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:
[UriFormatException: Invalid URI: There is an invalid sequence in the string.]
System.Uri.UnescapeString(Char* pStr, Int32 start, Int32 end, Char[] dest, Int32& destPosition, Char rsvd1, Char rsvd2, Char rsvd3, UnescapeMode unescapeMode, UriParser syntax, Boolean isQuery, Boolean readOnlyConfig) +618
System.Uri.UnescapeDataString(String stringToUnescape) +280
MongoDB.Driver.MongoUrlBuilder.Parse(String url) +237
MongoDB.Driver.MongoUrl..ctor(String url) +47
MongoDB.Driver.MongoUrl.Create(String url) +121
MongoDB.Driver.MongoServer.Create(String connectionString) +54
MongoDatabaseWrapper.get_Database() +30
Why would the UnescapeString() method or this stack of calls behave differently if the code is running on my local PC versus on Azure?

Upgraded project to Visual Studio 2010, but now get MVC error

I have an asp.net mvc 1.0 project. I upgraded the project and solution to Visual Studio 2010. However, I do not want to use asp.net mvc 2.0. My app compiles under mvc 1.0. All my references are to 1.0. I have copy local true and i am referencing mvc 1.0 from a lib folder, not the GAC.
However I keep getting this error:
No parameterless constructor defined for this object.
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.MissingMethodException: No parameterless constructor defined for this object.
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:
[MissingMethodException: No parameterless constructor defined for this object.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +86
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +230
System.Activator.CreateInstance(Type type, Boolean nonPublic) +67
System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(Type controllerType) +82
[InvalidOperationException: An error occurred while creating a controller of type 'PartingOut.Web.Controllers.HomeController'. If the controller doesn't have a controller factory, ensure that it has a parameterless public constructor.]
System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(Type controllerType) +189
System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) +74
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +128
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +57
System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) +7
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
Its like it wants to keep using asp.net mvc 2.0, because its complaining about that GetControllerInstance method.
This project works fine in vs 2008. wahhh! :(
Anyone? Anyone?
Thanks in advance.
I'm just trying to cover all the bases here, so forgive me if this is an obvious answer, but: Does PartingOut.Web.Controllers.HomeController actually have a parameterless constructor?
I figured it out.
Nothing to do with asp.net mvc 2 or vs 2010. It was still referencing asp.net mvc 1.0 fine. One of the other developers had done the upgrade and took out the "overrides" keyword in the method:
IController GetControllerInstance(Type controllerType)
on our own custom ControllerFactory.
Meh.

Subtext install gives error in Medium trust level

I am trying to install Subtext in a medium trust level environment (host: Crystaltech) and am getting the following error (see below). I was able to do the administration setup but when it tries to go to the blog for actual use, boom.
I know I could "upgrade" the environment to a full trust level but I want to understand why the error is happening and the ramifications of that moving to fUll trust before I do it.
To expand upon this question; what are the "Trust Levels"?
Security Exception
Description: The
application attempted to perform an
operation not allowed by the security
policy. To grant this application the
required permission please contact
your system administrator or change
the application's trust level in the
configuration file.
Exception Details:
System.Security.SecurityException:
Request for the permission of type
'System.Security.Permissions.SecurityPermission,
mscorlib, Version=2.0.0.0,
Culture=neutral,
PublicKeyToken=b77a5c561934e089'
failed.
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:
[SecurityException: Request for the
permission of type
'System.Security.Permissions.SecurityPermission,
mscorlib, Version=2.0.0.0,
Culture=neutral,
PublicKeyToken=b77a5c561934e089'
failed.]
System.Web.Security.UrlAuthorizationModule.CheckUrlAccessForPrincipal(String
virtualPath, IPrincipal user, String
verb) +47
Subtext.Framework.UrlManager.UrlReWriteHandlerFactory.GetHandlerForUrl(String
url) +66
Subtext.Framework.UrlManager.UrlReWriteHandlerFactory.ProcessHandlerTypePage(HttpHandler
item, HttpContext context) +143
Subtext.Framework.UrlManager.UrlReWriteHandlerFactory.GetHandler(HttpContext
context, String requestType, String
url, String path) +340
System.Web.HttpApplication.MapHttpHandler(HttpContext
context, String requestType,
VirtualPath path, String
pathTranslated, Boolean useAppConfig)
+175 System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+128 System.Web.HttpApplication.ExecuteStep(IExecutionStep
step, Boolean& completedSynchronously)
+161
I don't think there is another way to get around the error other than moving to full trust or removing the call to CheckUrlAccessForPrincipal() and recompiling.
But by the looks of things, this particular issue has already been corrected in the subtext SVN (revision 3290). They have also added a new build task for subtext 2.0.1 which should include the fix. I guess that will be released when it's ready.
Trust levels are really just pointers to some security.config files. The dafault trust levels are defined in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\web.config, "Medium" trust pointing to web_mediumtrust.config.
As for the exception, taking a look at System.Web.Security.UrlAuthorizationModule.CheckUrlAccessForPrincipal() with reflector reveals that the method is attributed with [SecurityPermission(SecurityAction.Demand, Unrestricted=true)], meaning that it requires an unrestricted security permission, which it does not have running under medium trust.
More grist to add to the mill from csgero:
http://www.kowitz.net/archive/2008/08/15/upgrading-to-subtext-2.0-fail.aspx
There's a wee comment from Phil Haack, I guess he's busy with other stuff right now :)

Resources