Error (0x80070542) in website using custom account in application pool - asp.net-mvc-3

My ASP.NET MVC 3 website was working fine, and then this afternoon I started getting a 500 error, although the only thing I changed was to enable 32-bit applications. I changed that back but the error remains. I've even deleted my app pool and web site and recreated them in IIS with no luck.
If I revert the app pool back to AppPoolIdentity I do not get this error (but I cannot access my database then, I need that custom account to read my database with integrated security).
Can anyone point me in the right direction?
ModuleName IIS Web Core
Notification 2
HttpStatus 500
HttpReason Internal Server Error
HttpSubStatus 0
ErrorCode 2147943746
ConfigExceptionInfo
Notification AUTHENTICATE_REQUEST
ErrorCode Either a required impersonation level was not provided, or the provided impersonation level is invalid. (0x80070542)
UPDATE:
I enabled impersonation and impersonated a user with admin access to the machine. I received this error in response, which does not tell me much more:
Could not load file or assembly 'Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Either a required impersonation level was not provided, or the provided impersonation level is invalid. (Exception from HRESULT: 0x80070542)

Well, a full uninstall and reinstall of IIS managed to do the trick for me.
I had to follow the instructions here: http://forums.iis.net/t/1170286.aspx in order to do it properly.

Related

Getting error while fetch the page of ADFS

I have installed the ADFS 2.0 on windows server 8, When I am going to fetch the page (FormsSignIn.aspx) which is under adfs/ls dierctory I am getting below error
There was a problem accessing the site. Try to browse to the site again.
I have checked the logs in event viewer and got the below message
Microsoft.IdentityServer.Protocols.Saml.HttpSamlMessageException: MSIS7015: This request does not contain the expected protocol message or incorrect protocol parameters were found according to the HTTP SAML protocol bindings.
at Microsoft.IdentityServer.Web.HttpSamlMessageFactory.CreateMessage(HttpContext httpContext)
at Microsoft.IdentityServer.Web.FederationPassiveContext.EnsureCurrent(HttpContext context)
I have checked all the possible way but not able to reslove this problem.
Please assist.
If you are wanting to utilize Forms authentication in ADFS, you do not access this page directly, rather you configure the ADFS web.config for forms authn and you claims enable your application / service provider (SP). The methods for claims enabling an application can vary depending on the version of Windows Identity Foundation (WIF) used.

How can I know what version of wif is installed on my server

I have a windows 2008 R2 Server, my apps use framework 4.5
<compilation targetFramework="4.5.1">
but suddenly one of my apps stopped authenticating against my authentication app in the same server. others do, others just dont the page the page redirect well to the auth site and auth ok, but on the way back to my app the page show the error"connection reset" each time I Try, I see a warning in the event viewer
Exception type: HttpException
Exception message: Cannot redirect after HTTP headers have been sent.
If I try this app in another server or local in my computer it authenticates just fine.
So I think is a matter of WIF versions installed on the server, but I'm Not sure.
Exist any way to know What Wif Versions are installed?
Thanks
Solved,
It was due to miss information on the third app webconfig, was the certificate information was invalid, so it tried to find a certificate that didnt exist on the server.

MVC Application endpoint Authentication Required for subdomain

I have a c#.net MVC3 application running on Windows Server 2008 R2 Datacenter.
If I deploy the application as an application under the main site (i.e. www.mysite.com/crm) it works perfectly.
If I deploy the application as a sub-domain to the main site (i.e. crm.mysite.com) it appears to work as expected, with the exception of one endpoint (crm.mysite.com/reports/view). That path returns the following authentication notice:
Authentication Required
The server http://crm.mysite.com:80 requires a username and password.
I am not aware of anything special for that endpoint and, as I mentioned, it works without issues when deployed under the main site.
What would cause this? How do I remove/prevent it?
I don't even know what code to provide to help diagnose the problem. Please let me know if you want to see parts of the code for any section related to this issue.
UPDATE:
I don't move the path to the application files for either situation and they both use the same application pool. The only difference is how a user access the files via IIS.
UPDATE2:
If I authenticate a user, I get this error:
Server Error in '/Reports' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Why would it think the resource doesn't exist when clearly it does?
If you have authentication on the main site, it won't automatically carry authentication across to the sub-domain. You would have to develop a mechanism to handle that such as SSO (single sign on).
Another potential issue is permissions for the directory/application (eg. c:\inetpub\wwwroot\crm.mysite.com)

Security Exception in MVC3

Hi I met the following problem when achieve a function "send an email to members" in my membership application. I did some research and add
<system.web>
<securityPolicy>
<trustLevel name="Full" policyFile="internal"/>
</securityPolicy>
</system.web>
to my Web.config, then deployed to server again, but the problem still exists. Any ideas? Thanks in advance.
Server Error in '/TestApp' 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.Net.Mail.SmtpPermission, System, 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.
When sending the email you might be specifying the SMTP port number which might not be allowed.
Here is an example of what I'm talking about:
SecurityException: Request for the permission of type 'System.Net.Mail.SmtpPermission'

Access denied on RenderAction

I am working on a new project and am trying to log into the site (it uses forms authentication), but as soon as I log in I get this error.
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: 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:
Line 10:
Line 11: <div id="partialListOfAuctionsDiv">
Line 12: #{ Html.RenderAction("PartialListOfAuctions"); }
Line 13: </div>
Line 14: </fieldset>
The line that is highlighted as the source of the error is
#{ Html.RenderAction("PartialListOfAuctions"); }
I have no idea what this might mean and how to solve it. Any help would be greatly appreciated.
Thanks,
Sachin
It looks as if the ASP.NET process does not have physical access to the web folder. The fact that you can access the site before you are authorized implies that MVC can access the files before then; this implies that its credentials are being changed after you log in. This only happens, I believe, when you have Impersonation turned on. Look for this line in your web.config:
<identity impersonate="true" />

Resources