Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controller not hitting and request pending , no response from server #2523

Closed
rsmmukesh opened this issue Mar 30, 2019 · 32 comments
Closed

Controller not hitting and request pending , no response from server #2523

rsmmukesh opened this issue Mar 30, 2019 · 32 comments
Assignees

Comments

@rsmmukesh
Copy link

rsmmukesh commented Mar 30, 2019

Controller not hitting and request pending , no response from server

Please check the below application.

Run the application you will get home page, i have placed a file uploader and submit button in form. and i have index post method in home controller. submit the form without selecting the file. then controller not hitting and request pending for long time. No result coming back from server .

now i cant continue my project. please give me solution for this.

WebApplication3.zip

@karelz
Copy link
Member

karelz commented Mar 30, 2019

Can you try to minimize the repro - find out which part breaks, follow tutorials (does HelloWorld work for you?) and check your machine setup (doe it fail on brand new VM or another machine?)

@karelz karelz added needs-more-info Not enough information has been provided. Please share more detail as requested. area-aspnet labels Mar 30, 2019
@rsmmukesh
Copy link
Author

Hi, the attached is the smallest application
. it has only one controller and 1 action.. "hello world" is working fine and all other things are working. but the situation is.. when i have file uploader in the form and trying to bind to modal the request not hitting the controller and no response from server .. browser keep loading always.

please download the attached file and run the application.... u will get a file uploader in home page. just click submit button.. the request will not hit controller. if you change model for the file then it will hit.

@rsmmukesh
Copy link
Author

The problem is not only in .net core asp. in .net core web api also not working in same case.
i have checked in multiple machines.

@rsmmukesh
Copy link
Author

Hi,
I have simplified the solution. Please check. Controller not hitting after click submit button without selecting any file in file browser.

WebApplication2.zip

@ep0x
Copy link

ep0x commented Apr 1, 2019

Do you hitting request while in debugging mode or without debugging? From my personal experience, sometimes it can get stuck while debugging. Try to run your program without debugging and post comment here. @rsmmukesh

@rsmmukesh
Copy link
Author

Hi,
without debugging also it is not working. i think it is data binding issue in .net core.
please try the application i have uploaded.
just run the application then you will understand everything ..

@rsmmukesh rsmmukesh reopened this Apr 1, 2019
@rsmmukesh
Copy link
Author

Sorry wrongly close button clicked.

@rsmmukesh
Copy link
Author

rsmmukesh commented Apr 1, 2019

i have checked in .net core and .net core api. controller not hitting and no response from server. browser keep loading. please download and check the attached application.. just 5 min needed

@karelz
Copy link
Member

karelz commented Apr 1, 2019

I don't know what you mean by "i have checked in .net core and .net core api"

@karelz karelz removed the needs-more-info Not enough information has been provided. Please share more detail as requested. label Apr 1, 2019
@rsmmukesh
Copy link
Author

Actually im created a .net core web api application for server side needs. when im working on it i got this issue. so i have checked the same scenario in .net core mvc application. i got the same issue there also.

@ep0x
Copy link

ep0x commented Apr 2, 2019

@rsmmukesh You are really wasting our time. First you need to learn fundamentals of ASP CORE and if you have problem based on your code, try to find solution on internet first.
Second this repo is for framework development not for your practice in programming.
Solution for you is to learn basic folder structure in MVC and you will notice you miss something.

your from should look like this
`
@using WebApplication2.Models
@model WebApplication2.Models.AModel

<label asp-for="@Model.data[0].myfile">Filename:</label>
<input asp-for="@Model.data[0].myfile" type="file" name="file" id="file" />

<input type="submit" />

`
And please close this issue since is not an framework issue.

@ep0x
Copy link

ep0x commented Apr 2, 2019

WebApplication2.zip

@rsmmukesh
Copy link
Author

@ljupko123 , Actually you are wasting my time, already 3 days wasted . Have you find out why the controller not hitting and server not responding? your answer is another way of doing.
Have you tested the application you send me?
i suggest you please learn fundamentals of ASP CORE before answering. it is not mandatory to specify model in the view. we can have plain html code and naming of the control should be match in order to bind the data.
My application is a mobile app(Cordova). i can not use model codes in view , it is a html page . i can have the naming of the controls correctly in order to bind the data.

This solution i have simplified to make you understand the problem

These are my models

public class AModel { public List<BModel> data { get; set; } }

public class BModel { public IFormFile myfile { get;set; } }

Controller
public IActionResult Index() { return View(); } [ActionName("Index")] [HttpPost] public IActionResult Index_Post([FromForm]AModel model) { return View(); }

View

<form method="post" enctype="multipart/form-data">
    <input type="file" name="model.data[0].myfile" />
    <input type="submit" />
</form>

See above code, did you find any mistake? even if any mistake the solution should generate error. now the controller is not hitting and browser keep loading.

i need selected files to model. if this is not right place to specify this issue then tell me where i have to raise this issue.

Please don't behave like trying to escape from problem.

@rsmmukesh
Copy link
Author

rsmmukesh commented Apr 2, 2019

image is not binding properly into the model . class inside class(property) is the problem.

@rsmmukesh
Copy link
Author

product- variant[0] - image[0]
- image[1]
variant[1] - image[0]
- image[1]
this is the real time scenario

@karelz
Copy link
Member

karelz commented Apr 2, 2019

Let's try to be civil to each other. I don't think we need accusations of wasted time, etc..

Just to set expectations: GitHub is not a support channel, we do not have SLAs for answering any issues, and some questions might be unanswered for a long time / forever.

I am not ASP.NET expert and this question here is sadly a bit confusing to me - it does not describe clearly to me what is problem, what has been tried, how is it isolated and which area the problem may be in, etc. Having a minimal repro is great, however, we should not expect that it will be used right away by others. Opening and debugging repros is time consuming and having few probing questions first is often more efficient way to find solutions. Again ... just to set expectations.

]I'll leave the technical answer to ASP.NET experts if/when they have time.

@rsmmukesh
Copy link
Author

i really sorry to disturb you. i have posted the issue because i stuck in my application.

i will say it in simple.
i have a image file selection in my page and save button... when i click save button the selected file data should get in server side in order to save that file to folder.
but in my case the selected file data is not getting in server side to save in the folder.

Normal case if we use IFormFile in the controller we get the selected data, it is working fine for me .

But i have situation like below, in this situation im not getting the selected file data in server side also no call coming to server side , browser keeps loading, no respose from server side.

public class AModel {
public List data { get; set; }
}

public class BModel {
public IFormFile myfile { get;set; }
}

Anyone understand the problem now?

@Eilon
Copy link
Member

Eilon commented Apr 2, 2019

Hi @rsmmukesh , I think at this point it would be best to post a new issue to https://github.com/aspnet/AspNetCore/issues with complete details on how to reproduce this issue. Please include a full application and steps to reproduce. Thank you!

@Eilon Eilon closed this as completed Apr 2, 2019
@ep0x
Copy link

ep0x commented Apr 2, 2019

@karelz You are right let be civil, I did not want to be rude i just pointed as throwing time for nothing about framework issues. This kind of questions should be asked on stack overflow and not here. If it is a framework issue its ok to post here.

@rsmmukesh for the next time when you post an issue make sure to provide valuable details like you just said in comment "My application is a mobile app(Cordova)." and it will lead us to clue that you don't need typically MVC model bindings. We are here to solve problems not to argue.
And once again you need to learn fundamentals of ASP CORE and my statement is correct, so i will explain you and you will fix problem easy in this case.

So, Asp Core is smart enough to recognize name="model.data[0].myfile" as generic type of array or list in your post request to your controller but, your controller doesn't accept generic type as an input right? because your current controller is this :

public IActionResult Index_Post([FromForm]AModel model)
this controller must accept generic type and it shall be :

public IActionResult Index_Post([FromForm]IList<AModel> model)

This is just fundamentals of MVC.

And remember this: There is not place on this planet or universe like this, universe of developers where every single developer try to help each other. Trust me I did not have any intentions to offend you in any case, i just wish to point you to go in right direction.

I hope i did help here and now you can proceed with your development :)

@rsmmukesh
Copy link
Author

No, base is normal class, inside the class i have generic.
AModal is same as Product
BModel is same as product variants

im trying to save a single product.
but it can have multiple variants and each variants can have multiple images.

other things are working as expected. but the variant image browsing is the problem.
controller will not hit and browser keep loading.
if i remove the file browse code from page then the controller is hitting.
i hope some issue is there in data binding to modal for the files

@rsmmukesh
Copy link
Author

@Eilon ... thanks.. i will open the issue there.

@karelz
Copy link
Member

karelz commented Apr 2, 2019

I assumed that this is .NET Core problem. If it is .NET Framework problem, then it does NOT belong here, nor to aspnet/AspNetCore repo - @rsmmukesh is that the case?

@rsmmukesh
Copy link
Author

I don't know where is the issue. You people can only identify the issue easily because you have the source code. from my side controller is not hitting.

Controller not hitting and no response from server, Browser keep loading .

To reproduce the issue, just download the attached application, then run the application. then you will get home page, it contains a text box and file uploader. Just click submit button. controller will not hit.

Then problem is when i use file , controller is hitting if i remove the below code from the BModel class
public IFormFileCollection myfile { get; set; }

WebApplication2.zip

im sure you need only 1 minute to reproduce the issue, download ->run->click submit button (so i hope im not wasting your time).

@karelz
Copy link
Member

karelz commented Apr 3, 2019

@rsmmukesh I think you misunderstood my question above - I was asking if you are running on .NET Framework or on .NET Core. Can you please answer that?

BTW: Given that I know nothing about ASP.NET, running the app in 1 minute is not going to tell me anything. If it is bug in your code, I won't be able to tell.

@rsmmukesh
Copy link
Author

On .net core only

@rsmmukesh
Copy link
Author

do anyone check this issue?

@karelz
Copy link
Member

karelz commented Apr 4, 2019

No - see above: #2523 (comment)

@rsmmukesh
Copy link
Author

Hi,
@karelz , Thanks for the support. It is actually a bug in 2.2 version. They are fixed in 3.0 preview.

@nammadhu
Copy link

nammadhu commented Oct 18, 2019

Hi Mukesh, Even am facing the same issue since 10 days . Could you please let me know whether you got any solution or have you raised any other ticket ... Please let me know very urgent...

Or Are you sure this 2.2 defect... please confirm

@rsmmukesh
Copy link
Author

It works when i have tried with .net core 3.0 preview 5 something . i think in the .net core 3 release it will work. try new version

@rsmmukesh
Copy link
Author

in .net core 2.2 it wont work. i tried a lot.

@yberstad
Copy link

I had similar issue, this fixed the issue:
dotnet/aspnetcore#4802 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants