나는've written 는 일 개월,지난 몇 일 동안 나는've 오류가 아래에 설치되는 버전입니다.
실행하는 경우 원본 코드에 대한 모든 것을 잘 작동합니다. 또,.exe 에 빈 폴더를 잘 작동합니다. It's 만 설치된 버전는 오류를 생성합니다면 내가 다시 컴파일하고 다시 내가 같은 오류가 있습니다.
나는'm 비트 바싹하이 무엇's 을 일으키는 이와 기대에 대한 몇 가지 있다. 그것은 있을 것 같 WebRequest 응답을 통한 즉은 반환되지 않지만 나는'm 난처한 이유 그것은 작품에 대지 않고 어떤 오류가 있습니다. 이 있는 새로운 IE 보안 조치/정책 이것을 일으키는 원인이 될 수 있는?
일 I've 지금까지 시도 포함한다:
-장애인 모든 바이러스 백신&a,방화벽 -관리자 권한으로 실행
예외:
Exception: System.Windows.Markup.XamlParseException: The invocation of the constructor on type 'XApp.MainWindow' that matches the specified binding constraints threw an exception. ---> System.Net.WebException: The remote server returned an error: (403) Forbidden.
at System.Net.HttpWebRequest.GetResponse()
at XApp.HtmlRequest.getHtml(Uri uri) in J:\Path\MainWindow.xaml.cs:line 3759
at XApp.MainWindow.GetLinks() in J:\Path\MainWindow.xaml.cs:line 2454
at XApp.MainWindow..ctor() in J:\Path\MainWindow.xaml.cs:line 124
--- End of inner exception stack trace ---
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc)
at System.Windows.Application.LoadComponent(Uri resourceLocator, Boolean bSkipJournaledProperties)
at System.Windows.Application.DoStartup()
at System.Windows.Application.<.ctor>b__1(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
Exception: System.Net.WebException: The remote server returned an error: (403) Forbidden.
at System.Net.HttpWebRequest.GetResponse()
at XApp.HtmlRequest.getHtml(Uri uri) in J:\Path\MainWindow.xaml.cs:line 3759
at XApp.MainWindow.GetLinks() in J:\Path\MainWindow.xaml.cs:line 2454
at XApp.MainWindow..ctor() in J:\Path\MainWindow.xaml.cs:line 124
편집:
이로 설치된 콘텐츠입니다. 때 나는've 관리자 권한으로 실행,나는'압축을 풀어 프로그램 폴더가 및 관리자 권한으로 exe 파일을 실행보다 오히려 무료로 다운로드하실 수 있습니다.
코드는 원인 문제는 이
private void GetLinks()
{
//Navigate to front page to Set cookies
HtmlRequest htmlReq = new HtmlRequest();
OLinks = new Dictionary<string, List<string>>();
string Url = "http://www.somesite.com/somepage";
CookieContainer cookieJar = new CookieContainer();
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url);
request.CookieContainer = cookieJar;
request.Accept = @"text/html, application/xhtml+xml, */*";
request.Referer = @"http://www.somesite.com/";
request.Headers.Add("Accept-Language", "en-GB");
request.UserAgent = @"Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)";
request.Host = @"www.somesite.com";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
String htmlString;
using (var reader = new StreamReader(response.GetResponseStream()))
{
htmlString = reader.ReadToEnd();
}
//More Code
}
다음 줄을 추가합니다:
request.UseDefaultCredentials = true;
이 응용 프로그램의 자격 증명을 사용하여 로그인한 사용자가 사이트에 액세스할 수 있습니다. 경's 돌아온 403 명확하게 it's 기대하고 인증합니다.
It's 당신이 당신(지금은?) 이 인증 프록시에 사격 사이트입니다. 어떤 경우에,try:
request.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
이게 도움이 되었으면 좋겠습니다.
처럼 보이는 문제입을 기반으로 서버 측.
Im 나의 케이스와 함께 일 paypal 서버의도는 제안 답변이었지만,http://forums.iis.net/t/1217360.aspx?HTTP+403+금지+오류
었다면 이 문제의 답변은 페이팔에서 기술적인 부분입니다. 이 추가 해결됩니다 403 문제입니다.
된 플러그 가능한 req=(된 플러그 가능한)WebRequest.Create(url);
req.UserAgent="[어떤 말보다 더 5 자]";
private class GoogleShortenedURLResponse
{
public string id { get; set; }
public string kind { get; set; }
public string longUrl { get; set; }
}
private class GoogleShortenedURLRequest
{
public string longUrl { get; set; }
}
public ActionResult Index1()
{
return View();
}
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult ShortenURL(string longurl)
{
string googReturnedJson = string.Empty;
JavaScriptSerializer javascriptSerializer = new JavaScriptSerializer();
GoogleShortenedURLRequest googSentJson = new GoogleShortenedURLRequest();
googSentJson.longUrl = longurl;
string jsonData = javascriptSerializer.Serialize(googSentJson);
byte[] bytebuffer = Encoding.UTF8.GetBytes(jsonData);
WebRequest webreq = WebRequest.Create("https://www.googleapis.com/urlshortener/v1/url");
webreq.Method = WebRequestMethods.Http.Post;
webreq.ContentLength = bytebuffer.Length;
webreq.ContentType = "application/json";
using (Stream stream = webreq.GetRequestStream())
{
stream.Write(bytebuffer, 0, bytebuffer.Length);
stream.Close();
}
using (HttpWebResponse webresp = (HttpWebResponse)webreq.GetResponse())
{
using (Stream dataStream = webresp.GetResponseStream())
{
using (StreamReader reader = new StreamReader(dataStream))
{
googReturnedJson = reader.ReadToEnd();
}
}
}
//GoogleShortenedURLResponse googUrl = javascriptSerializer.Deserialize<googleshortenedurlresponse>(googReturnedJson);
//ViewBag.ShortenedUrl = googUrl.id;
return View();
}
이 아't 데 도움이 너무 많은 사람들이지만,이 경우:사용 Jira Rest Api 를 사용하여 내 개인적인 자격 증명(는 것을 사용하여 로그인 Jira). 나 업데이트 내 Jira 암호를 그러나 잊어를 업데이트들에서 나의 코드입니다. 나 403 오류를 했어를 업데이트 내 암호 코드에서 하지만 여전히 가지고 오류가 있습니다.
솔루션:내가 했으로 로그인 Jira(에서 자신의 로그인 페이지)을 나는 입력한 텍스트를 증명하지 않았't 다. 후에는 내가 다시 시도 코드에서 일했다. 테이크 아웃:서버를 잠글 수 있습니다.