SharePoint Sandbox Solution Failing based on Web Address used - c#

I have a SharePoint 2010 Sandbox Solution working perfectly on my dev machine if I view the page as: http://dev/page.aspx it works great.
However, if I view the page as http://dev.corp.company.com/page.aspx I get the following error:
Web Part Error: Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: File Not Found.
Error throws even when viewing a blank web part with no code behind.
[assembly: AllowPartiallyTrustedCallers()]
is present.

It looks like I need to configure alternate access mappings:
http://technet.microsoft.com/en-us/library/cc288609(office.12).aspx
Alternate access mappings have not been configured. Users or services
are accessing the site http://dev with the URL
http://dev.corp.company.com. This may cause incorrect links to be
stored or returned to users. If this is expected, add the URL
http://dev.corp.company.com as an AAM response URL. For more
information, see: http://go.microsoft.com/fwlink/?LinkId=114854"
ALSO:
The Web application at http://skynet.redmond.corp.microsoft.com/ could
not be found. Verify that you have typed the URL correctly. If the URL
should be serving existing content, the system administrator may need
to add a new request URL mapping to the intended application. at
Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean
contextSite, SPUserToken userToken) at
Microsoft.SharePoint.SPSite..ctor(String requestUrl) at
Microsoft.SharePoint.SPSite_SubsetProxy.SPSite__Factory(String
requestUrl)

Related

HttpClient.SendAsync call results in multiple triggers on service side, returns internal server error

I have an ASP.NET Web API deployed on Azure App service.
I am experiencing following error: For one specific business object my Web API's GET method is returning Internal server error, while for other business objects the same GET method is working fine.
When I debugged my Web API it turned out, that valid business object is returned, but… GET method was triggered multiple times (and on client side I see that it is called only once)
This is an excerpt where Web API is called from client code
// Create HTTP transport objects
HttpRequestMessage httpRequest = new HttpRequestMessage();
httpRequest.Method = HttpMethod.Get;
httpRequest.RequestUri = new Uri(url);
// Set Credentials
if (this.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
await this.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
}
HttpResponseMessage httpResponse = await this.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);
Besides - if I try to open that same url from browser (e.g.: https://myservice.com/api/businessObject/xxx) - request is performed only once (as it should) and correct results (Json) is displayed in browser.
Any suggestions what to try to figure why call from client side (for specific object) results in multiple Web API service executions and how to fix this?
My Web API service is deriving from System.Web.Http.ApiController
I got some information from exception, but it doesn't seem to be very helpful
Exception thrown: 'Microsoft.Rest.TransientFaultHandling.HttpRequestWithStatusException' in Microsoft.Rest.ClientRuntime.dll The thread 0x27fc has exited with code 0 (0x0)
EDIT
I got some information from Azure Log stream, but that information does not seam to make sense… because this problem happens for one specific business object (and only when requested from my application - not failing from web browser), other business objects are working fine so I don't see how this could be related to access / web.config file...
IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
IIS was not able to process configuration for the Web site or application.
The authenticated user does not have permission to use this DLL.
..
Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web servers machine account.
Check the event logs to see if any additional information was logged.
Verify the permissions for the DLL.
Install the .NET Extensibility feature if the request is mapped to a managed handler.
Create a tracing rule to track failed requests for this HTTP status code

Cannot create a local site on a IP (default.aspx not getting hit)

I cannot get a default.aspx page to show on IIS. I am running a windows server 2012 box. IIS 8. The site has a default.aspx page in its root directory. It is a application. The site is bound to a specific IP Address. When i hit that IP i do not get a default page. When i target the page 10.10.10.10/default.aspx i get the following error
HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler.
Most likely causes:
•The request matched a wildcard mime map. The request is mapped to the static file handler. If there were different pre-conditions, the request will map to a different handler.
Things you can try:
•If you want to serve this content as a static file, add an explicit MIME map.
Detailed Error Information:
Module
StaticFileModule
Notification
ExecuteRequestHandler
Handler
StaticFile
Error Code
0x80070032
Requested URL
http://10.10.10.10/default.aspx
Physical Path
C:\inetpub\wwwroot\testSite\default.aspx
Logon Method
Anonymous
Logon User
Anonymous
More Information:
I am not sure what could be configured wrong. Does any have any recommendations?
Asp.net is not enabled by default on Server 2012. You need to use Add Roles and Features. On the features tab of the wizard, make sure the correct version of .Net is selected to be installed and that HTTP Activation is also selected.

IIS throwing HTTP 404 not found but resource exists. Requested URL also changing automatically.!

I'm facing a really weird scenario here with my local IIS. I have hosted multiple sites in the default website in my local IIS. One of them has the login page. From the login page, I'm redirecting the user to another page that is located in another site (which is also hosted in the same IIS inside default website virtual directory).
Now in the submit button click event of my login page, after authenticating the user, I have written a "Response.Redirect(redirect_url)". the redirect_url is being formed dynamically and given as a parameter to the Redirect method.
While debugging, the final redirect_url that is being sent as parameter to Redirect method is:
http://localhost/CP/web/console/console.aspx?sk=3e3cc1a8-73c4-4945-b3f8-08af22ea4324.50008
But after I try to go to the next step, I'm suddenly getting a HTTP 404 error saying that the resource doesn't exist and I have observed that Requested URL shown in the error page is different that what was dynamically sent to the Response.Redirect(...) method.
In the error page, the requested url shows the value as
http://localhost/CP/web/console/localhost/CPLogin?err=5
whereas my actual requested url formed in the code is:
http://localhost/CP/web/console/console.aspx?sk=3e3cc1a8-73c4-4945-b3f8-08af22ea4324.50008
I'm just unable to understand why the requested url is getting changed automatically.! Also, I observe that "localhost" is being appended to the requested URL again which is not what is supposed to happen.
Please visit THIS link[^] to understand this question more clearly. I have added screen shot of the error page.
http://amoghnatu.wordpress.com/2013/09/16/question-please-help-iis-throwing-http-404-not-found-but-requested-resource-actually-exists-requested-url-also-changing-automatically/[^]
Thanks a lot.!
Indeed, the problem was with the way I had hosted the sites in my application. I just removed all the sites related to my application from IIS and then hosted all of them again much more carefully. This resolved the "wrong redirect url" problem.
Also, I had some tables with missing required data because of which I was getting the error code.
So after I got all the tables filled with the required data and also after properly hosting the application in IIS, my problem got resolved.
In IIS, go to relevant folder, right click and "browse". Check out what is the URL. In most cases, this is due to the URL should have port number appended. For instance it will be something like :
http://localhost:<port number>/CP/web/console/console.aspx?sk=3e3cc1a8-73c4-4945-b3f8-08af22ea4324.50008
instead of
http://localhost/CP/web/console/console.aspx?sk=3e3cc1a8-73c4-4945-b3f8-08af22ea4324.50008

URL Rewriting not working with URL ending ".ad" or ".cd"

I'm having some difficulties with my custom URL-rewriting setup. I'm not using any 3rd party tool to manage this, just using the global.asax by looking at every request and processing it.
The way I am using it is like:
www.mydomain.com/site/google.com
This page contains information about the site "google.com". I'm using the actual domain within the URL. This is all works fine.
I have simplified the code that I'm using just to show you an example of how it works:
Dim myContext As HttpContext = HttpContext.Current
Dim URL As String = myContext.Request.ServerVariables("URL")
If URL.ToLower.Contains("/site/") Then
URL = URL.Trim("/")
Dim strURL As String = URL.ToLower.Split("/")(1)
Redirect301("/site.aspx?url=" & strURL)
Exit Sub
End If
The issue I'm having is for certain domain extensions, the page will just load up custom 404 Not Found and I have no idea what the cause is.
Example of pages that don't load:
/site/google.ad
/site/google.cd
I'm guessing that the system thinks that .cd and .ad files are actual physical files and when it doesn't find them, it shows the custom 404 error. It doesn't actually looks like the request is getting through to the global.asax. When working in local environment, they actually load fine but only on the live server it has this issue and this is why it has been a nightmare trying to figure it out.
Another issue I found was loading the following URL:
/site/prn.com
This shows a 404 error again but this time not the custom one I created but the actual hard looking .net 404 error page. This also works fine in local environment.
There must be some IIS setting or code change I could do to try to get this resolved.
Thank you for your time :)
Aki
Check this link . Error message when you try to browse a Web page that is hosted on IIS 7.0: "HTTP Error 404.7 – FILE_EXTENSION_DENIED
This is the reason .ad .cd extensions are blocked.

WCF URL host segment is changed to full domain name

I have a page fetching HTML content from a WCF REST service via AJAX. I started seeing errors on IE to the effect that "This page is accessing information that is not under its control...". For some content, the WCF service will, instead of returning the content directly, return instead an object or iframe tag pointing back to itself with different parameters. The WCF service sees a different URL than was requested, and the discrepancy causes the "security" error as IE thinks it's loading content from a different domain.
So, for example, the XHR request asked for
"http://localhost/Services/Content.svc?id=123..."
or even
"http://mymachine/Services/Content.svc?id=123..."
As soon as the request reaches the WCF service, however, the URL is turned into:
"http://mymachine.mydomain.com/Services/Content.svc?id=123..."
How can I get the originally requested URL within the WCF service? I've inspected theWebOperationContext.Current.IncomingRequest.UriTemplateMatch properties to no avail, there is no remaining trace of "localhost". I've also looked at the following posts and still cannot find the original URL:
What is the WCF equivalent of HttpContext.Current.Request.RawUrl?
http://jstawski.com/archive/2008/05/01/wcf-wsdl-location-address-with-https.aspx
Is there any way to get to it?
Be aware that any service running in IIS will use the host name specified in the IIS bindings. In order to change this, you will need to change the settings in IIS.

Categories

Resources