Contact form - cannot bind source type to model type
Hi,
New to Umbraco so built a contact form with a tutorial. When I deployed the site to Azure the first time (with an sdf database sitting in AppData) I got the error "cannot bind source type to model type". I managed to fix it by changing ModelsBuilder.ModelsMode to AppData in the web.config file and it works fine.
As an exercise I then created a second web app in Azure but moved the database to Azure's sql database. Connection string works, but I get the same error "cannot bind source type to model type" now that I can't seem to fix.
I'm not sure why I'm getting the error (i.e. what I've coded that causes the issue) but also how to fix it.
I understand the error is due to my contact form. Here's the code. Any help appreciated
If I change the view to @inherits EsportsGold.standardwebsite.ContactModel then i get the following error
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0115: 'ASP.PageViewsPartialsContactFormView_cshtml.Execute()': no suitable method found to override
Source Error:
Line 47: }
Line 48:
Line 49: public override void Execute() {
Line 50:
Line 51: #line 3
Contact form - cannot bind source type to model type
Hi,
New to Umbraco so built a contact form with a tutorial. When I deployed the site to Azure the first time (with an sdf database sitting in AppData) I got the error "cannot bind source type to model type". I managed to fix it by changing ModelsBuilder.ModelsMode to AppData in the web.config file and it works fine.
As an exercise I then created a second web app in Azure but moved the database to Azure's sql database. Connection string works, but I get the same error "cannot bind source type to model type" now that I can't seem to fix.
I'm not sure why I'm getting the error (i.e. what I've coded that causes the issue) but also how to fix it.
I understand the error is due to my contact form. Here's the code. Any help appreciated
Contact form partial view
ContactSurfaceController
Have you tried specifying the model as simply
EsportsGold.standardwebsite.ContactModel
?Eg
@inherits EsportsGold.standardwebsite.ContactModel
in the first line of the view?Hi Stefano
Thanks for the suggestion. Just tried it.
If I change the view to
@inherits EsportsGold.standardwebsite.ContactModel
then i get the following errorServer Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0115: 'ASP.PageViewsPartialsContactFormView_cshtml.Execute()': no suitable method found to override
Source Error:
Line 47: } Line 48:
Line 49: public override void Execute() { Line 50:
Line 51: #line 3
"D:\home\site\wwwroot\Views\Partials\ContactFormView.cshtml"
Which if I understand correctly means the name now doesn't match and can't be executed?
is working on a reply...