|
I've never had a problem adding moq to a project.
|
|
|
|
|
I'm not sure how everything went so sideways. There were unstated dependencies in the package, and some of the referenced dlls couldn't be found - it was a mess. When I tried to uninstall it, I got errors in nuget, and had to manually remove everything. :/
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
how to get oulook current user context in adaptive cards and actionable messages onclick of comment/like in email?
|
|
|
|
|
|
I have an Asp.Net Web API2 running on a Windows Server 2012R2 here at the office.
Now, we set up another server running Window Server 2019 Standard and I am attemping to host the API there but I cannot connect to it. When I attempt to reach a test controller at"http://192.168.50.153:8092/api/test/test" I get a 404.
Again, this is working on another server. I just can't connect to it on this one.
Do I need to open a port? I did, but that doesn't see to make a difference.
I'm not really sure how to debug this. Could use some help.
Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
If it's hosted in IIS, try opening the URL in a browser running on the server. You should get a lot more detail in the error message.
You could also try IIS failed request tracing:
Troubleshooting Failed Requests Using Tracing in IIS 8.5 | Microsoft Docs[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Well, I WAS getting a reponse on the server in a browser with http://192.168.50.153:65078/api/test/test
Now, I get a 404.
That Tracing looks like a LOT of work.
Quick question... to install in IIS all I did was open my API project folder, zip everything up, unzip
on the server, and point IIS to it. This worked on the previous server. Is this the way to do this? Can you point me to any resources on installing a Web API on a server?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
That should work, assuming the relevant IIS features are installed, and you're not using .NET Core.
If you're not getting a detailed error message when you access the page on the server, then Failed Request Tracing is the way to go. It's really not that difficult to set up.
- Enable FRT:
- Open IIS Manager and select your site;
- On the right-hand side, click on "Failed request tracing..." under "Configure";
- Tick the "Enabled" box;
- Click "OK";
- Configure a tracing rule for 404 errors:
- In the main pane, double-click "Failed request tracing rules";
- On the RHS, click "Add...", and set up the rule:
- All content - Next
- Status codes: 404 - Next
- Leave all providers ticked - Finish
- Generate an error and view the log file:
- Open the URL which isn't working in a browser;
- Open the
%systemdrive%\inetpub\logs\FailedReqLogFiles\... folder in Windows Explorer; - Open the XML file in Internet Explorer;
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks, I'll try it.
The message I get in the browser on the server is something like "File or folder" not found.
Not looking at it right now.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Thanks Richard - why the caveat about
Richard Deeming wrote: and you're not using .NET Core. I am getting an invalid web.config error and will use the above as another check.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
|
Thanks Richard, I do wonder if that is needed on the localhost of the dev box, some light reading TY.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
The log file has a LOT of info. The only thing I can see is "The system cannot find the file specified", but it doesn't tell me WHAT file.
The web page it creates has "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
I'm still stuck.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
When I came back from lunch my system has restarted.. I guess there was some system update...
At any rate I can' debug with chrome anymore.. web browser is not started by visual studio anymore...
Anyone else having the same issue?
|
|
|
|
|
I'm running Chrome Version 75.0.3770.90 (Official Build) (64-bit) which it up to date apparently, and I can get into the devtools without any problems.
Windows is Win10 1803 17134.829 which should be up to date as well.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thanks Real Griff! Mm... the plot thickens.... :/
|
|
|
|
|
Have you tried turning it off and back on again?
(The internet, possibly?)
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
it's working today!
|
|
|
|
|
Could you please provide code example with jquery chatbot code example for static answers?
|
|
|
|
|
Seriously, you have been a member for 12 years and you have not worked out that we do not do your work for you. Do the research, do the work and when you hit a problem then ask for help and we will be more than happy to help YOU code it..
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
Specifically, in a MVC application.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
HTML, CSS task
Draw 3*3 Rubik’s cube
Conditions:
Use CSS Grid Layout standards for creating grid inside each 6 layers
Use CSS variables to avoid redundant code
HTML/CSS Code should be Fexible enough to conveH 3X3 grid to any NXN grid
Would be beLer if you use CSS preprocessors - optional
JS task
Rotate the same cube generated using device orientation API
When you rotate the mobile/tablet cube should rotate in opposite direction of the
device motion
Make use of throLling to avoid unnecessary renderings
|
|
|
|
|
Final task
Realize nobody here is going to do your homework for you.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
It is incredibly rude and extremely lazy to post your homework and not even ask a question.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
A bit long but I'm really stuck here.
I've posted about this before, but I stil can't figure out what's wrong, so I"m going to extend my question with a lot more code.
I'm working on a WPF app that calls an Asp.net WebAPi. I'm having trouble calling Web API methods. In some cases, the API call succeeds and in some cases it fails. The issue seems to be the TYPE of params being passed.
I could really use someone with a lot more insight than me to help. Google searches lead me all over the place and I"m really stuck.
For example, this method works fine
[HttpPost]
public Response<Guid> AddRuleDefinition(RuleDefinitionEntity entity)
{
var response = new Response<Guid>();
try
{
IRulesBL bl = GetBL();
response.Data = bl.AddRuleDefinition(entity);
}
catch (Exception e)
{
response.Exception = e;
}
return response;
}
This only works if I pass the Guid as a string:
[HttpDelete]
public Response DeleteRuleDefinition([FromUri] string id)
{
var response = new Response();
try
{
IRulesBL bl = GetBL();
bl.DeleteRuleDefinition(new Guid(id));
}
catch (Exception e)
{
response.Exception = e;
}
return response;
}
This works, but the results list is null. The 'trigger' parameter is there:
[HttpPost]
public Response<List<string>> ExecuteRuleGroup(List<AssayResultEntity> results, string trigger)
{
var response = new Response<List<string>>();
try
{
IRulesBL bl = GetBL();
response.Data = bl.ExecuteRuleGroup(trigger, results);
}
catch (Exception e)
{
response.Exception = e;
}
return response;
}
I call the methods from the client using an wrapper class I call WebAPIExecutor.
public class WebAPIExecutor
{
private RestClient client;
<pre>
private RestRequest request;
public string ServerAddress { get; private set; }
public string URL { get; private set; }
public WebAPIExecutor(CredentialsEntity credentials, string ipAddress, string controller, Method method = Method.POST)
{
ServerAddress = string.Format("<a href="http:
client = new RestClient(ServerAddress);
client.AddHandler("text/plain", new JsonDeserializer());
request = new RestRequest(controller, method)
{
RequestFormat = DataFormat.Json
};
}
public void AddParameter(object value, string name = "")
{
if (value == null)
{
throw new ArgumentNullException("value");
}
Type type = value.GetType();
bool isPrimitive = type.IsPrimitive;
if (isPrimitive || type == typeof(string) || type == typeof(decimal))
{
if (string.IsNullOrEmpty(name) && request.Method == Method.GET)
{
throw new ArgumentNullException("Parameter 'Name' cannot be empty for Get requests");
}
request.AddParameter(name, value);
}
else
{
request.AddBody(value);
}
}
public async Task<T> ExecuteAsync<T>() where T : new()
{
URL = client.BaseUrl + request.Resource;
IRestResponse<t> restResponse = await client.ExecuteTaskAsync<t>(request, new CancellationToken());
var result = (T)restResponse.Data;
if (!string.IsNullOrEmpty(restResponse.ErrorMessage))
{
throw new Exception(restResponse.ErrorMessage);
}
else
{
if ((int)restResponse.StatusCode >= 299)
{
string message = string.Format("An error occured calling the WebAPI. {0} The status code is '{1}'. {2} The error message is {3}",
Environment.NewLine, restResponse.StatusCode, Environment.NewLine, restResponse.Content);
throw new Exception(message);
}
}
return result;
}
public async Task ExecuteAsync()
{
URL = client.BaseUrl + request.Resource;
IRestResponse result = null;
try
{
result = await client.ExecuteTaskAsync(request);
int resultCode = (int)result.StatusCode;
if (resultCode > 299)
{
string message = string.Format("An error occured calling the WebAPI. {0} The status code is '{1}'. {2} The error message is {3}",
Environment.NewLine, resultCode, Environment.NewLine, result.Content);
throw new Exception(message);
}
}
catch (Exception e)
{
throw e;
}
}
}
Then I created a proxy which has many methods that all look like this:
public async Task<Response<Guid>> AddRuleDefinitionAsync(RuleDefinitionEntity entity)
{
var webAPIExecutor = new WebAPIExecutor(Credentials, ServerUrl, "/Rules/AddRuleDefinition/", Method.POST);
webAPIExecutor.AddParameter(entity, "entity");
return await webAPIExecutor.ExecuteAsync<Response<Guid>>();
}
Here's my WebAPIConfig:
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional });
}
}
Global.Asax.cs
public class WebApiApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
GlobalConfiguration.Configuration.MessageHandlers.Add(new APIKeyHandler());
GlobalConfiguration.Configuration.MessageHandlers.Add(new AuthHandler());
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
GlobalConfiguration.Configuration.Formatters.Remove(GlobalConfiguration.Configuration.Formatters.XmlFormatter);
GlobalConfiguration.Configure(WebApiConfig.Register);
}
}
Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|