System.ServiceModel.FaultException in WCF service [closed] - c#

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a WCF service which worked fine til today, an exception System.ServiceModel.FaultException was thrown, when i call a method of the this service.
using (EService = new FaService.EServiceClient())
{
DataSet ds = EService.GetCompanies(3375); // exception here
DataTable dt = ds.Tables[0];
foreach (DataRow dr in dt.Rows)
{
Companies.Add(new Company() { Name = dr["c0"].ToString() });
}
}

In a service, the FaultException class is used to create an untyped fault to return to the client for debugging purposes. It really handles generic or "unknown" faults in a process in the program/client. You can pinpoint the error down to a line and typically can just debug your system/program/client to find where this "unknown" error is occurring. It may be helpful to post this method's code in which you are having issues, but as for your post thus far, I would debug your program and step line by line to make sure there isn't any unnecessary lines of code.
Reference: http://msdn.microsoft.com/en-us/library/system.servicemodel.faultexception(v=vs.110).aspx

Related

Selenium C# Interact with Chrome Microphone Window [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have an application that when initiated, I receive the popup that "https://example.com wants to:"
"Use your microphone"
I have looked at autoit but it has not been helping. I was trying to use an x/y coordinate but no luck. The autoit window info gives me a name and a class but button info is not there.
Anyone have a way around this issue?
Works perfectly:
$WinTitle = "[CLASS:Chrome_WidgetWin_1]"
WinWait($WinTitle)
WinActivate($WinTitle)
ControlSend($WinTitle, "", "", "{TAB}{ENTER}")
Here is how I got around it using AutoIT. Remove one of the Send("+{TAB}") to set it to Block. I tried removing both of these and just using the enter for Allow but it did not work.
Allow Microphone for Chrome:
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=chromeClickAllow.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
Sleep(2000)
WinActivate("Tabs Outliner")
WinWait("[CLASS:Chrome_WidgetWin_1]")
Sleep(500)
WinActivate("[CLASS:Chrome_WidgetWin_1]")
Send("+{TAB}")
Send("+{TAB}")
Send("{ENTER}")

HtmlAgilityPack XPath This is an unclosed string [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I need to parse a page and get inner text from specified textbox on that page. But, when I compiled this code:
HtmlAgilityPack.HtmlDocument infoDoc = new HtmlAgilityPack.HtmlDocument();
HtmlNode.ElementsFlags["br"] = HtmlElementFlag.Closed;
infoDoc.LoadHtml(#ProblemPageSource.ToString());
HtmlNode bodyGlobal = #infoDoc.DocumentNode.SelectSingleNode(".//body").SelectSingleNode(".//div[#class='global']");
HtmlNode globalRight = #bodyGlobal.SelectSingleNode(".//div[#class='globalRight']");
HtmlNode formPanel = #globalRight.SelectSingleNode(".//form").SelectSingleNode(".//div[#class='panel]");
ProblemCode = #formPanel.SelectNodes(".//div")[0].SelectSingleNode(".//textarea").OuterHtml.ToString(); //And here is now NullRefEx :(
codeEditor.Text = #ProblemCode.ToString();
I had an exception throwed from Xpath with message "this string is unclosed".
And...source of the page I need to parse hosted at GitHub Gist.
UPD: Minimalistic version:
Minimalistic version of the code viewed in the MozDevTools
Can anybody help me please?
P.S. Sorry for my bad english!
P.S.S. When I checked the code by W3C Validator there are no any unclose tags...but many errors (not my problem :) )
P.S.S.S. Yes, I am using CEFsharp to view the pages, and I get sources from him. So, if it uses autocorrection of Html, why this code is broken? :(
Besides the uncolsed single quote in in your ".//div[#class='panel]" you will need to call:
HtmlAgilityPack.HtmlNode.ElementsFlags.Remove("form");
Before you create an instance of your HtmlDocument because form elements are allowed to overlap and thus handled differently, after that you'll be able to deal with forms as any other element.
so the following shall do:
HtmlAgilityPack.HtmlNode.ElementsFlags.Remove("form");
HtmlNode.ElementsFlags["br"] = HtmlElementFlag.Closed;
var infoDoc = new HtmlAgilityPack.HtmlDocument();
infoDoc.LoadHtml(#ProblemPageSource.ToString());
HtmlNode bodyGlobal = infoDoc.DocumentNode.SelectSingleNode("//body//div[#class='global']");
HtmlNode globalRight = #bodyGlobal.SelectSingleNode(".//div[#class='globalRight']");
HtmlNode formPanel = #globalRight.SelectSingleNode(".//form//div[#class='panel']");
var ProblemCode = #formPanel.SelectSingleNode(".//div/textarea").OuterHtml.ToString();
Correct SelectSingleNode(".//div[#class='panel]"); to SelectSingleNode(".//div[#class='panel']");.

Creation of log file on user choice [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
We have a console application name JetIDR. Where we are using log4net for logging log . THis application are currently creating 2 log file JetIDR-INFO.LOG and JetIDR-Debug.LOG .We want to enhance out application to support flexibility on creating log file as below.
Command line parameter should be named as -log
Valid parameter for -loglevel are 1 and 2 only
When parameter 1 is used with -loglevel JetIDR-INFO.LOG file should get created
When parameter 2 is used with -loglevel then JetIDR-INFO.LOG & JetIDR-DEBUG.LOG file should get created
We need to do it in C#.
Your question is effectively "how do I conditionally suppress output to an appender?", where the condition is "If the -loglevel is 1, don't write to the debug logs."
The code would then look like this:
if (logLevel == 1)
{
// assuming appender name is DebugAppender and it is a FileAppender
var appender = log4net.LogManager.GetRepository()
.GetAppenders()
.OfType<FileAppender>()
.SingleOrDefault(a => a.Name == "DebugAppender");
if (appender != null)
{
// Disable the appender
appender.Threshold = Level.Off;
appender.ActivateOptions();
}
}
Note however that if the appender is defined in configuration, the log file is created when log4net is configured: this code thus cannot stop the file from being created, but it will suppress logging to the file.

C# Color coding for windows 8.1 (tablet) in visual studio 2013 [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
May I know how should I write the color code for
grid-background / textblock-foreground
if(Condition ==true)
{
gridName.Backgroud = //How to set color here
}
in visual studio 2013? (For Windows 8.1 tablet (surfaceRT) )
you can try these options
if(Contition == true)
{
// you can try this
grid.Background = new SolidColorBurush(Colors.Green);
// you can try this too
grid.Background = new SolidColorBrush(Color.FromArgb(255, 0, 255, 0);
}
If you having Error that Colors or Color does not exists or you are missing some assembly.
so just right Click on Colors/Color and choose Resolve Option. it is all done :)
Hope this helps :)
For ex
if(something == true)
{
grid.Background = new SolidColorBurush(Windows.UI.Colors.Red);
}

extract and format string in text file? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 8 years ago.
Improve this question
i have a text file in a format
CODE:8000012016
502 Bad Gateway
502 Bad GatewayHost Not Found or connection failed
CODE:8000012146
502 Bad Gateway
502 Bad GatewayHost Not Found or connection failed
CODE:8000023700
502 Bad Gateway
502 Bad GatewayHost Not Found or connection failed
.
.
.
.
.
.
.
.
CODE:8001129584
{"event_id":"0D004B66AA326A34","version":"1.6","error":{"system_unavailable":true,"no_tickets":true,"invalid":{"ticketing":true}},"command":"event_authenticate"}
CODE:8001129586
{"event_id":"0D004B66AA326A34","version":"1.6","error":{"system_unavailable":true,"no_tickets":true,"invalid":{"ticketing":true}},"command":"event_authenticate"}
.
.
.
.
.
i have to seperate these two formats and save in new different text files.
OK, more details please... As I see, you can search for HTML tags.
for example:
foreach(LineOfText line in text)
{
foreach(Word in line)
{
if(Word is HtmlTag)
{
mark current line as type1;
put current line in string1;
}
else
{
mark current line as type2;
put current line in string2;
}
}
}
SaveString(string1);
SaveString(string2);

Categories

Resources